Exemple #1
0
 /**
  * 商品展示方案审核
  * @param int $opType      1通过 -1拒审
  * @param int $mproshowid 审核表主键
  * @param int $supid      用户id
  * @return boolean true/false
  * @author zhuyuping <[<email address>]>
  */
 public function check($mproshowid = '', $opType = '', $checkdesc = '', $mname = '', $proshowArr = array())
 {
     $mproshowid = intval($mproshowid);
     $opType = intval($opType);
     if ($mproshowid <= 0 || empty($opType) || empty($mname)) {
         return $this->outputData('', '600', '参数错误');
     }
     $mobj = Mproshow::findFirst(array('id = ?1', 'bind' => array(1 => $mproshowid)));
     if (!empty($mobj) && empty($mobj->state)) {
         $mArr = $mobj->toArray();
     } else {
         return $this->outputData(false, '600', '方案信息不存在');
     }
     //模块内容非空的id
     $moduleidArr = array();
     foreach ($proshowArr as $key => $oneArr) {
         if (!empty($oneArr['modulecontent'])) {
             $moduleidArr[] = $oneArr['id'];
         }
     }
     $msg['supid'] = $mArr['supid'];
     //审核通过
     if ($opType == 1) {
         //更新方案主表(表单、状态)
         foreach ($proshowArr as $key => $oneinfo) {
             $obj = Proshow::findFirst(array("id = ?1 and state = 0", 'bind' => array(1 => $oneinfo['id'])));
             if (!empty($obj)) {
                 $obj->modulename = $oneinfo['modulename'];
                 $obj->modulecontent = $oneinfo['modulecontent'];
                 if (in_array($oneinfo['id'], explode(',', $mArr['showid']))) {
                     $obj->state = $opType;
                 }
                 if ($obj->save() === false) {
                     continue;
                 }
             }
         }
         //更新审核表
         // $mobj->showid    = implode(',', $moduleidArr); //历史记录的查看与审核时看到的信息保持一致
         $mobj->state = $opType;
         $mobj->name = $mname;
         $mobj->checktime = time();
         if ($mobj->save() === false) {
             return $this->outputData(false, '600', $mobj->getMessages());
         }
         //站内信
         $msg['subject'] = "产品展示方案审核通过";
         $msg['message'] = '您添加的产品展示方案已经审核通过,在发布特权产品时可用正常展示产品展示方案了!【<a href="' . $this->di['config']->base->sup . '/product/special/index/">去发布特权产品</a>】';
     } else {
         //拒审
         //更新方案主表状态
         $idArr = explode(',', $mArr['showid']);
         if (!empty($idArr)) {
             foreach ($idArr as $key => $id) {
                 $obj = Proshow::findFirst(array("id = ?1 and state = 0", 'bind' => array(1 => $id)));
                 if (!empty($obj)) {
                     $obj->state = $opType;
                     if ($obj->save() === false) {
                         return $this->outputData(false, '600', $obj->getMessages());
                     }
                 }
             }
         }
         //更新审核表
         if (empty($checkdesc)) {
             return $this->outputData(false, '600', '拒审理由非空');
         }
         //$mobj->showid    = implode(',', $moduleidArr);
         $mobj->state = $opType;
         $mobj->name = $mname;
         $mobj->checkdesc = $checkdesc;
         $mobj->checktime = time();
         if ($mobj->save() === false) {
             return $this->outputData(false, '600', $mobj->getMessages());
         }
         $msg['subject'] = "产品展示方案审核未通过";
         $msg['message'] = '您添加的产品展示方案已经被拒审,原因是:(' . $checkdesc . ')!【<a href="' . $this->di['config']->base->sup . '/service/proshow/index">重新提交</a>】';
     }
     \Gcsupplier\Services\MsgService::getInstance()->addMsg($msg);
     return $this->outputData(true);
 }
 /**
  * 设置审核信息
  * @author 彭东江
  * @param int $id 主键id
  * @return array 审核信息
  */
 public function audit($id, $state, $comname, $checkdesc = '', $mname = '')
 {
     if (empty($id) || empty($state) || empty($comname) || empty($mname)) {
         return $this->outputData('', '600', '参数错误');
     }
     $certify = MGccertify::findFirst(array('id = ?1', 'bind' => array(1 => $id), 'order' => 'id DESC'));
     $certify->state = $state;
     $certify->checkdesc = $checkdesc;
     $certify->checktime = time();
     $certify->name = $mname;
     if ($certify->save()) {
         $com = Gccompany::findFirst(array('supid = ?1', 'bind' => array(1 => $certify->supid)));
         $com->is_gccertify = $certify->state;
         if ($com->save() && $com->is_gccertify == 1) {
             $gc_gccertify = new GcGccertify();
             $gc_gccertify->supid = $certify->supid;
             $gc_gccertify->state = 1;
             $gc_gccertify->comname = $comname;
             $gc_gccertify->addtime = time();
             $result = $gc_gccertify->save();
         }
     }
     $msg['supid'] = $certify->supid;
     if ($state == 1) {
         //工厂认证 添加基础评分
         $rabbit = new RabbitMQ($this->di['config']->rabbitmq_write->toArray());
         $queueData = json_encode(array('cid' => $com->cid, 'supid' => $certify->supid, 'scoretype' => 4));
         $rabbit->set('v3work', 'sup', $queueData, 'score');
         //工厂认证统计
         $array = array('supid' => $certify->supid, 'province' => $com->province, 'city' => $com->city, 'cate1' => $com->cate1, 'cate2' => $com->cate2, 'busmode' => $com->busmode, 'auth' => 1);
         Statistic::report(Statistic::SUP_PERSONAL_AUTH, $array);
         //站内信
         $msg['subject'] = "工厂认证审核通过";
         $msg['message'] = '您提交的工厂认证申请已经审核通过,拥有发布10条普通特权产品的权限,可以更好的提升营销效果。如需发布更多特权产品,您可以开通营销4.0服务!【<a href="' . $this->di['config']->base->sup . '/product/special/index/">发布特权产品</a>】【<a href="' . $this->di['config']->base->sup . '/cost/" target="_blank">开通营销4.0</a>】';
     } else {
         //站内信
         $msg['subject'] = "工厂认证被拒审";
         $msg['message'] = '您提交的工厂认证申请已经被拒审,拘审原因是:(' . $checkdesc . ')!【<a href="' . $this->di['config']->base->sup . '/company/gongchang/">重新认证</a>】';
     }
     \Gcsupplier\Services\MsgService::getInstance()->addMsg($msg);
     return $this->outputData($certify);
 }
 /**
  * 营业执照审核
  * @param id int 审核表主键
  * @param int                    $opType 1通过 -1拒审
  * @return boolean true/false
  * @author zhuyuping <[<email address>]>
  */
 public function check($id = '', $opType = '', $checkdesc = '', $mname = '', $postData = array())
 {
     $opType = intval($opType);
     if ($id <= 0 || empty($opType) || empty($mname)) {
         return $this->outputData('', '600', '参数错误');
     }
     $mobj = MCompermit::findFirst(array('id = ?1', 'bind' => array(1 => $id)));
     if (!empty($mobj) && empty($mobj->state)) {
         $mArr = $mobj->toArray();
         $cid = $mArr['cid'];
         $obj = Gccompermit::findFirst(array("cid = ?1", 'bind' => array(1 => $cid)));
         if (empty($obj) || !empty($obj->state)) {
             return $this->outputData(false, '600', '行业资格证信息不存在');
         }
     } else {
         return $this->outputData(false, '600', '要审核行业资格证信息不存在');
     }
     $this->di['gccominfo']->begin();
     $comObj = \Gccominfo\Models\Gccompany::findFirst(array("cid = ?1", 'bind' => array(1 => $cid)));
     if (empty($comObj)) {
         return $this->outputData(false, '600', '企业不存在');
     }
     $msg['supid'] = $mArr['supid'];
     $msg['addtime'] = time();
     //审核通过
     if ($opType == 1) {
         //执照通过否
         $is_buslicense = 0;
         $buslicenseObj = Mbuslicense::findFirst(array("cid  = ?1", 'bind' => array(1 => $cid), 'order' => 'id desc'));
         if (!empty($buslicenseObj) && $buslicenseObj->state == 1) {
             $is_buslicense = 1;
         }
         //发产品否
         $is_pubpro = 0;
         $proObj = \Gcproinfo\Models\Pdinfo::findFirst(array('cid = :cid:', 'bind' => array('cid' => $cid)));
         if ($proObj) {
             $is_pubpro = 1;
         }
         //企业资料已完善
         if ($is_buslicense == 1) {
             $comObj->is_complete = 1;
         }
         if ($is_buslicense == 1 && $is_pubpro == 1) {
             //已完善 + 已发
             $comObj->state = 1;
         } elseif ($is_buslicense == 0 && $is_pubpro == 1) {
             //未完善 + 已发
             $comObj->state = -4;
         } elseif ($is_buslicense == 1 && $is_pubpro == 0) {
             //已完善 + 未发
             $comObj->state = -3;
         } else {
             $comObj->state = -2;
         }
         $comObj->save();
         //更新资格证主表 客服修改的信息
         if (isset($postData['permitno'])) {
             $obj->permitno = $postData['permitno'];
         }
         if (isset($postData['permittype'])) {
             $obj->permittype = $postData['permittype'];
         }
         if (isset($postData['endtime'])) {
             $obj->endtime = strtotime($postData['endtime']);
         }
         //更新审核表
         $mobj->checktime = time();
         $mobj->state = $opType;
         $mobj->name = $mname;
         //站内信
         $msg['subject'] = "行业资格证审核通过";
         $msg['message'] = '您提交的行业资格证已经审核通过,可以在工厂网经营该行业产品,快去发布产品吧!【<a href="' . $this->di['config']->base->sup . '/product/new/">立即发布</a>】';
     } else {
         //拒审
         //更新审核表
         if (empty($checkdesc)) {
             return $this->outputData(false, '600', '拒审理由非空');
         }
         $mobj->checkdesc = $checkdesc;
         $mobj->checktime = time();
         $mobj->state = $opType;
         $mobj->name = $mname;
         //站内信
         $msg['subject'] = "行业资证被拒审";
         $msg['message'] = '您提交的行业资格证已经被拒审,原因是:(' . $checkdesc . ')!【<a href="' . $this->di['config']->base->sup . '/company/index/init2/">重新提交</a>】';
     }
     //更新资格证主表
     $obj->state = $opType;
     if ($obj->save() === false) {
         $this->di['gccominfo']->rollback();
         return $this->outputData(false, '600', $obj->getMessages());
     }
     //更新审核表
     if ($mobj->save() === false) {
         $this->di['gccominfo']->rollback();
         return $this->outputData(false, '600', $mobj->getMessages());
     }
     $this->di['gccominfo']->commit();
     if ($opType == 1 && $is_buslicense == 1 && $is_pubpro == 1) {
         $rabbit = new RabbitMQ($this->di['config']->rabbitmq_write->toArray());
         $queueData = json_encode(array('cid' => $cid, 'supid' => $comObj->supid));
         $rabbit->set('v3work', 'open', $queueData, 'store');
     }
     \Gcsupplier\Services\MsgService::getInstance()->addMsg($msg);
     return $this->outputData(true);
 }