增加商品
@param array $data 商品详细信息
@return array|bool
@throws \yii\web\HttpException
961858
public function addProduct(array $data)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_PRODUCT_ADD_PREFIX, $data, [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'success' ? $result['product_id'] : false;
    }
410088
public function getUserShare(array $data)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_USER_SHARE_GET_PREFIX, $data, [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['list']) ? $result['list'] : false;
    }
1096111
public function addShelf(array $data)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_SHELF_ADD_PREFIX, $data, [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'success' ? $result['shelf_id'] : false;
    }
810618
public function add(array $data)
    {
        $result = null;
        $this->hook->attach('language.add.before', $data, $result, $this);

        if (isset($result)) {
            return (bool) $result;
        }

        if (!empty($data['default'])) {
            $this->setDefault($data['code']);
        }

        $default = $this->getDefaultData();
        $data += $default;

        if (empty($data['name'])) {
            $data['name'] = $data['code'];
        }

        if (empty($data['native_name'])) {
            $data['native_name'] = $data['name'];
        }

        $languages = $this->config->select('languages', array());
        $languages[$data['code']] = array_intersect_key($data, $default);

        $result = $this->config->set('languages', $languages);
        $this->hook->attach('language.add.after', $data, $result, $this);
        return (bool) $result;
    }
818921
public function setAgent(array $data)
    {
        $result = $this->httpRaw(self::WECHAT_AGENT_SET_PREFIX, $data, [
            'access_token' => $this->getAccessToken()
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'ok';
    }
602029
public function getUpStreamMessage(array $data)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_UP_STREAM_MESSAGE_GET_PREFIX, $data, [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['list']) ? $result['list'] : false;
    }
1330376
public function create(array $data)
    {
        $user = User::create([
            'name'                  => $data['name'],
            'email'                 => $data['email'],
            'password'              => bcrypt($data['password']),
            'birthday_at'           => $data['birthday_at'],
            'locale'                => $data['locale'],
            'gender'                => $data['gender'],
            'city'                  => $data['city'],
            'about'                 => $data['about'],
            'profession'            => $data['profession'],
            'hobbies'               => $data['hobbies'],
            'homepage'              => $data['homepage'],
            'skype'                 => $data['skype'],
            'facebook'              => $data['facebook'],
            'twitter'               => $data['twitter'],
            'main_character'        => $data['main_character'],
            'main_guild'            => $data['main_guild'],
            'favorite_race'         => $data['favorite_race'],
            'favorite_spec'         => $data['favorite_spec'],
            'favorite_instance'     => $data['favorite_instance'],
            'favorite_battleground' => $data['favorite_battleground'],
        ]);

        return $user;
    }
724254
public function addPoi(array $data)
    {
        $result = $this->wechat->httpPost(self::WECHAT_POI_ADD_PREFIX, $data, [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errmsg']) && $result['errmsg'] === 'ok';
    }
824257
public function insert(array $data)
    {
        $this->normalizeDataColumns($data);

        $this->setSearchIndexableData($data);

        return $this->app['db']->insert($this->getTable(), $data);
    }
630573
public function create(array $data) {
        $this->_checkAcl('create');
        $pk = $this->_model->insert($data);
        return $pk;
    }
908296
public function create(array $data)
    {
        $parameters = ['name' => $data['name']];

        foreach ($data['config'] as $key => $value) {
            $parameters["config.$key"] = $value;
        }

        return $this->post('plugins/', [
            'json' => $parameters
        ]);
    }
611929
public function add(array $data)
    {
        $data = $this->resolverFactory->createAppResolver()->resolve($data);

        return $this->api->request('POST', '/apps', [
            'Authorization' => 'Basic '.$this->api->getConfig()->getUserAuthKey(),
        ], json_encode($data));
    }
77750
public function createCard(array $data)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_CARD_CREATE_PREFIX, $data, [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errmsg']) && $result['errmsg'] === 'ok' ? $result['card_id'] : false;
    }
865927
public function add(array $data): Insert
    {
        if (!isset($data[0]) && count($this->fields) == 0) {
            $this->fields(array_keys($data));
        }

        $this->data[] = $data;
        return $this;
    }
596845
public function import(array $data)
    {
        $response = $this->client->post("{$this->uriImport}product/", [
            'json' => $data,
            'query' => [
                'key' => $this->config['data']['key'],
            ],
        ]);

        $response = json_decode($response->getBody(), true);

        if (isset($response['affected']) && $response['affected'] > 0) {
            return true;
        }

        return false;
    }
639762
public function updateDepartment(array $data)
    {
        $result = $this->httpRaw(self::WECHAT_DEPARTMENT_CREATE_PREFIX, $data, [
            'access_token' => $this->getAccessToken()
        ]);
        return isset($result['errcode']) && !$result['errcode'];
    }
962053
public function add(array $data)
    {
        $defaults = array(
            "description" => null,
            "price"       => null,
            "discount"    => null,
            "qty"         => 1,
            "unit"        => null
        );

        $merged = array_merge($defaults, $data);

        $line = $this->create($this->invoiceHandle);

        if( isset($merged['product']) )
        {
            $this->product($line, $merged['product']);
            unset( $merged['product'] );
        }

        return $this->update($data, $line);
    }