/**
  * 改变中国好产品 状态,并添加进投票项
  * @param int $id 活动产品id
  * @param int $status 活动产品状态
  *
  * @return json
  * */
 public function actionStatus()
 {
     $admin = Yii::$app->util->isAdminLogin();
     if (!$admin && !Yii::$app->util->isAjax()) {
         echo Yii::$app->util->formatResEncode('1001', 'login error');
         exit;
     }
     $params = Yii::$app->request->post();
     $rel_id = isset($params['id']) ? intval($params['id']) : '';
     $status = isset($params['status']) ? intval($params['status']) : '';
     if (empty($rel_id) || empty($status)) {
         echo Yii::$app->util->formatResEncode('1002', 'param error');
         exit;
     }
     $mActivityProduct = new ActivityProduct();
     $actproduct = $mActivityProduct->getDetailBypk($rel_id);
     $product = $actproduct['product']['name'];
     if ($mActivityProduct->changeStatus($rel_id, $status)) {
         $msg = '产品:' . $product . '状态更改成功!';
         //审核通过 增加投票项
         if ($status == ActivityProduct::STATUS_VERIFY_THROUGH) {
             $mapattrval = new ActivityProductAttrVal();
             $attrval = $mapattrval->getRealAttrVals($rel_id, ActivityBase::GOOD_PRODUCT);
             $city = $attrval['division']['val'];
             $poll_type_id = PollType::GOODPRODUCT_TYPE;
             $mpoll = new poll();
             $pollone = $mpoll->getPollByCity($city, $poll_type_id);
             if ($pollone) {
                 $option = ['poll_id' => $pollone['poll_id'], 'owner_id' => $rel_id, 'option_name' => $product, 'option_type_id' => ActivityBase::GOOD_PRODUCT];
                 $mpolloption = new PollOption();
                 //判断该活动产品 是否已经添加进去投票项
                 $isoption = $mpolloption->isOptionRel($option);
                 if (!$isoption) {
                     $option_id = $mpolloption->storeSave($option);
                     if ($option_id) {
                         if (!strpos($pollone['poll_option_ids'], $rel_id)) {
                             $mpoll = new poll();
                             $ids = empty($pollone['poll_option_ids']) ? $rel_id : $pollone['poll_option_ids'] . ',' . $rel_id;
                             $mpoll->storeSave(['poll_id' => $pollone['poll_id'], 'poll_option_ids' => $ids]);
                         }
                         $option_id ? $msg .= ',添加成为投票项' : '';
                     }
                 }
             }
         }
         echo Yii::$app->util->formatResEncode('0', $msg);
     } else {
         echo Yii::$app->util->formatResEncode('1003', '更改失败!');
     }
 }