/** * 查看域名绑定详情,这里会获取企业的基本信息进来,直接调用了model来获取! 只查询基本信息! * @param integer $id 在表m_coMStatcode中的主键 * @return array(fmart) */ public function detail($id) { $id = intval($id); if ($id == 0) { $conditions = array('conditions' => 'state=0', 'order' => 'id desc'); } else { $conditions = array('conditions' => 'id=:id:', 'bind' => array('id' => $id)); } $data = MStatcode::findFirst($conditions); if ($data) { $comInfo = Gccompany::findFirst(array('columns' => 'comname,username', 'conditions' => 'supid=:supid:', 'bind' => array('supid' => $data->supid))); $data = $data->toArray(); $data['comname'] = $comInfo->comname; $data['username'] = $comInfo->username; return $this->outputData($data); } else { return $this->outputData('', '404', '没有找到'); } }
/** * 遍历企业信息查询产品打入队列 */ public function runAction() { $cid = 0; while (1) { $comMysql = Gccompany::find(array("conditions" => "cid > ?1", "bind" => array(1 => $cid), "columns" => "cid, state", "limit" => 100, "order" => "cid asc")); $comMysqlRs = $comMysql->toArray(); if (empty($comMysqlRs)) { exit("所有企业信息过滤完毕\n"); } foreach ($comMysqlRs as $value) { $cid = $value["cid"]; if ($value["state"] != 1) { echo "=============" . $cid . "企业状态不正常============\n"; continue; } $this->speAction($cid); } } }
/** * 运营商验证营业执照接口(运营商调取)营业执照默认通过+工厂认证默认通过 * @author zhuyuping 2015.08.28 * @return array */ public function saveLic($postData = array(), $cid = '', $supid = '') { $cid = intval($cid); $supid = intval($supid); if ($cid <= 0 || empty($postData) || $supid <= 0) { return $this->outputData('', '600', '参数错误'); } $comObj = \Gccominfo\Models\Gccompany::findFirst(array('cid = :cid:', 'bind' => array('cid' => $cid))); if (empty($comObj)) { return $this->outputData('', '600', '企业信息不存在'); } $tmpArr = array('ceo', 'regcapital', 'province', 'city', 'area', 'address', 'comname', 'username'); foreach ($tmpArr as $key => $value) { if (empty($postData[$value])) { return $this->outputData('', '600', $value . "不能为空"); } } $response = CombusinessService::getInstance()->getByName($postData['comname']); $businessInfo = !empty($response) && $response['code'] == 200 ? $response['data'] : array(); $comObj->licensestate = 1; $comObj->is_gccertify = 1; if ($businessInfo) { $comObj->cbcid = $businessInfo['cid']; //更新前台缓存 CombusinessService::getInstance()->updateGccid($cid, $businessInfo['cid']); } $save = array('lic' => array('cid' => $cid, 'supid' => $supid, 'state' => 1, 'comname' => $postData['comname'], 'ceo' => $postData['ceo'], 'regcapital' => intval($postData['regcapital']), 'province' => intval($postData['province']), 'city' => intval($postData['city']), 'zone' => intval($postData['area']), 'address' => $postData['address'], 'licensetype' => 2, 'licenseurl' => '', 'endtime' => 0, 'addtime' => time()), 'mlic' => array('cid' => $cid, 'supid' => $supid, 'username' => $postData['username'], 'comname' => $postData['comname'], 'addtime' => time(), 'checktime' => time(), 'state' => 1, 'checkdesc' => '运营商后台添加默认认证', 'name' => 'op'), 'certify' => array('supid' => $supid, 'state' => 1, 'comname' => $postData['comname'], 'ceo' => $postData['ceo'], 'addtime' => time()), 'mcertify' => array('supid' => $supid, 'addtime' => time(), 'checktime' => time(), 'state' => 1, 'checkdesc' => '运营商后台添加默认通过工厂认证', 'name' => 'op')); $Obj = GcBuslicense::findFirst(array('columns' => 'id, state', 'conditions' => "cid=:cid:", 'bind' => array('cid' => $cid))); if (is_object($Obj) && isset($Obj->state) && $Obj->state == 1) { return $this->outputData(true); } else { $this->di['gccominfo']->begin(); if (!is_object($Obj)) { $Obj = new \Gccominfo\Models\GcBuslicense(); } if ($Obj->save($save['lic']) === false) { return $this->outputData(false, '600', $Obj->getMessages()); } if ($comObj->save() === false) { $this->di['gccominfo']->rollback(); return $this->outputData(false, '600', $comObj->getMessages()); } $mlicObj = new \Gccominfo\Models\Mbuslicense(); if ($mlicObj->save($save['mlic']) === false) { $this->di['gccominfo']->rollback(); return $this->outputData(false, '600', $mlicObj->getMessages()); } $certifyObj = new \Gccominfo\Models\GcGccertify(); if ($certifyObj->save($save['certify']) === false) { $this->di['gccominfo']->rollback(); return $this->outputData(false, '600', $certifyObj->getMessages()); } $mcertifyObj = new \Gccominfo\Models\MGccertify(); if ($mcertifyObj->save($save['mcertify']) === false) { $this->di['gccominfo']->rollback(); return $this->outputData(false, '600', $mcertifyObj->getMessages()); } $this->di['gccominfo']->commit(); $scoretypeArr = array(3, 4); foreach ($scoretypeArr as $key => $scoretype) { $score = $this->di['config']->company->score[$scoretype]; $insertLogData = array('supid' => $supid, 'cid' => $cid, 'pid' => 0, 'scoretype' => $scoretype, 'score' => $score, 'addtime' => time()); $logObj = new Supscorelog(); //入评分日志表 $logObj->save($insertLogData); } $Obj = Supscore::findFirst(array("supid = :supid:", 'bind' => array('supid' => $supid))); if (is_object($Obj)) { $dataArr = array('basescore' => 80); } else { $Obj = new Supscore(); $dataArr = array('supid' => $supid, 'cid' => $cid, 'basescore' => 80); } //更新评分表 $Obj->save($dataArr); //执照认证统计 $array = array('supid' => $supid, 'province' => intval($postData['province']), 'city' => intval($postData['city']), 'cate1' => 0, 'cate2' => 0, 'busmode' => 1, 'licence' => 1); Statistic::report(Statistic::SUP_PERSONAL_LICENCE, $array); /* //工厂认证 添加基础评分 $queueData2 = json_encode(array('cid' => $cid, 'supid' => $supid, 'scoretype' => 4)); $rabbit->set('v3work', 'sup', $queueData2, 'score');*/ //工厂认证统计 $array = array('supid' => $supid, 'province' => intval($postData['province']), 'city' => intval($postData['city']), 'cate1' => 0, 'cate2' => 0, 'busmode' => 1, 'auth' => 1); Statistic::report(Statistic::SUP_PERSONAL_AUTH, $array); } return $this->outputData(true); }
/** * 得到一个审核信息 * @author 彭东江 * @param int $id 主键 * @return array 待审核信息 * lastModify zhuyuping 2015.09.07 */ public function get($id) { $id = $this->di['filter']->sanitize($id, 'int', 0); if (!empty($id)) { $mCertifyObj = MGccertify::findFirst(array('id = ?1', 'bind' => array(1 => $id))); //企业大门、设备、办公环境信息、提交时间、状态、原因等 $certifyInfo = $mCertifyObj->toArray(); $buslicenseObj = Gcbuslicense::findFirst(array("supid = ?1 and state = 1", 'bind' => array(1 => $certifyInfo['supid']))); //兼容gc_buslicense表无数据情况 if (is_object($buslicenseObj)) { $buslicenseArr = $buslicenseObj->toArray(); } else { $buslicenseArr = \Gccominfo\Models\Gccompany::findFirst(array("supid = ?1", 'bind' => array(1 => $certifyInfo['supid'])))->toArray(); } //营业执照公司名 $certifyInfo['comname'] = $buslicenseArr['comname']; // $supInfo = SupUser::findFirst(array("supid = ?1", 'bind' => array(1 => $certifyInfo['supid'])))->toArray(); // $certifyInfo['username'] = $supInfo['username']; } else { //获取正在审核的信息 $isOpen = ''; //$this->di['memObj']->get('sup_checkgccertify'); $conditions = ' state=0 '; // if (!empty($isOpen)) { // $conditions .= " and id not in({$isOpen})"; // } //倒序获取一条待审核的信息 $mCertifyObj = MGccertify::findFirst(array('conditions' => $conditions, 'order' => 'id desc')); if (empty($mCertifyObj)) { return $this->outputData(false, '600', '没有待审核信息或者审核信息正被其他客服审核'); } $certifyInfo = $mCertifyObj->toArray(); $supid = $certifyInfo['supid']; $buslicenseArr = Gcbuslicense::findFirst(array('supid = ?1', 'bind' => array(1 => $supid)))->toArray(); //营业执照公司名 $certifyInfo['comname'] = $buslicenseArr['comname']; // $supInfo = SupUser::findFirst(array("supid = ?1", 'bind' => array(1 => $certifyInfo['supid'])))->toArray(); // $certifyInfo['username'] = $supInfo['username']; //设置当前打开的执照信息 if (!empty($certifyInfo)) { if (empty($isOpen)) { $isOpenCertifyVal = $certifyInfo['id']; } else { $isOpenArr = explode(',', $isOpen); if (!in_array($certifyInfo['id'], $isOpenArr)) { $isOpenArr[] = $certifyInfo['id']; } $isOpenCertifyVal = implode(',', $isOpenArr); } //$this->di['memObj']->set('sup_checkgccertify', $isOpenCertifyVal, '', 300); } } return $this->outputData($certifyInfo); }
/** * 王兰兰--标记供应商的运营活动,随机出来50条供应商信息 * @param integer $cidStart [description] * @return [type] [description] */ public function getComInfo($cidStart = 0) { $cid = intval($cidStart); $res = array(); $params = array('conditions' => 'cid>=:cid: and cbcid != 0 and state=1', 'bind' => array('cid' => $cid), 'limit' => 50); $result = Gccompany::find($params); if (is_object($result)) { $resTmp = $result->toArray(); foreach ($resTmp as $key => $value) { $res[] = $value['cbcid']; } } return $this->outputData($res); }
/** * 获取商品展示方案供产品详情页展示 * @author zhuyuping * @return array */ public function getProShow($cid = '') { $cid = intval($cid); if ($cid <= 0) { return $this->outputData('', '600', '参数错误'); } //是否工厂认证企业 $comObj = \Gccominfo\Models\Gccompany::findFirst(array('columns' => 'cid,is_gccertify', 'conditions' => 'cid = ?1', 'bind' => array(1 => $cid))); $comArr = $comObj->toArray(); $is_gccertify = $comArr['is_gccertify']; if (empty($is_gccertify)) { return $this->outputData(false, '600', "不是工厂认证企业"); } $infoArr = Proshow::find(array('cid = ?1 and state = 1', 'bind' => array(1 => $cid)))->toArray(); if (empty($infoArr)) { return $this->outputData(false, '600', '暂无要展示的商品方案'); } return $this->outputData($infoArr); }
/** * 营业执照审核 * @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); }