/**
  * Create test wechat account
  *
  * <b>Request Type</b>: POST<br/><br/>
  * <b>Request Endpoint</b>:http://{server-domain}/api/management/channel/create-test-wechat<br/><br/>
  * <b>Content-type</b>: application/json<br/><br/>
  * <b>Summary</b>: This api is used to create test wechat account.
  * <br/><br/>
  *
  * <b>Request Params</b>:<br/>
  * <pre>
  *{
  *      "name":"唯1のse彩",
  *      "appId":"wx5c208e957d25a9fe",
  *      "appSecret":"79ac3d410703781ece8e99f162419b48",
  *      "originalId":"gh_3beb200f225e"
  * }
  * </pre>
  */
 public function actionCreateTestWechat()
 {
     $params = $this->getParams();
     $account = ["name" => $params['name'], "channelAccount" => $params['originalId'], "appId" => $params['appId'], "appSecret" => $params['appSecret'], "channel" => "WEIXIN", "accountType" => "SERVICE_AUTH_ACCOUNT"];
     //create a new account
     $info = Yii::$app->weConnect->createAccount($account);
     $channelId = $info['id'];
     //update account information and insert the new channel
     $accountId = $this->getAccountId();
     $createChannelResult = Channel::upsert($accountId, $channelId, Channel::WECHAT, $account['name'], $account['accountType'], true, $params['appId']);
     if (!$createChannelResult) {
         throw new ServerErrorHttpException("Update channel failed");
     }
     //initialize the default rules
     $types = ['SUBSCRIBE', 'RESUBSCRIBE', 'DEFAULT'];
     $this->_initDefaultRules($channelId, $types, $account['name'], self::SOCIAL_CHANNEL_WECHAT);
     return ['data' => $info];
 }