Ejemplo n.º 1
0
 /**
  * 获取init2页所需信息
  * @author francis
  * @param int id 用户id
  * @return array
  */
 public function getInit2($supid)
 {
     $com = \Gccominfo\Models\GcCompany::findFirst(array("supid=:supid:", 'bind' => array('supid' => $supid)));
     if (is_object($com)) {
         $com = $com->toArray();
     }
     $licObj = \Gccominfo\Models\GcBuslicense::findFirst(array("supid=:supid:", 'bind' => array('supid' => $supid)));
     if (is_object($licObj)) {
         $licObj = $licObj->toArray();
     }
     $mlicObj = \Gccominfo\Models\MBuslicense::findFirst(array("supid=:supid:", 'bind' => array('supid' => $supid), "order" => "id desc"));
     if (is_object($mlicObj)) {
         $mlicObj = $mlicObj->toArray();
     }
     $cid = $com['cid'];
     $compDataObj = \Gccominfo\Models\GcCompermit::findFirst(array("cid=:cid:", 'bind' => array('cid' => $cid)));
     if (is_object($compDataObj)) {
         $compDataObj = $compDataObj->toArray();
     }
     $mcompObj = \Gccominfo\Models\MCompermit::findFirst(array("supid=:supid:", 'bind' => array('supid' => $supid), "order" => "id desc"));
     if (is_object($mcompObj)) {
         $mcompObj = $mcompObj->toArray();
     }
     return $this->outputData(array('info' => $com, 'lic' => $licObj, 'comp' => $compDataObj, 'mlic' => $mlicObj, 'mcomp' => $mcompObj));
 }
Ejemplo n.º 2
0
 /**
  * 营业执照审核
  * @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);
 }