/** * 运营商验证营业执照接口(运营商调取)营业执照默认通过+工厂认证默认通过 * @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); }
/** * 删除功能 */ public function del($pid, $cid, $supid) { if (!is_array($pid)) { $pid = array($pid); } foreach ($pid as $v1) { $this->di['gcproinfo']->begin(); $infoobj = \Gcproinfo\Models\Pdinfo::findFirst(array('pid = :pid: and cid = :cid:', 'bind' => array('pid' => $v1, 'cid' => $cid))); if ($infoobj->state == 1 or $infoobj->state == -2) { if ($infoobj->cate3 > 0) { $procate = $infoobj->cate3; } else { $procate = $infoobj->cate2; } $cate2 = 0; $comInfo = ComBaseService::getInstance()->getCom($infoobj->supid); if ($comInfo['code'] == 200 and is_array($comInfo['data'])) { $cate2 = $comInfo['data']['cate2']; } $tongjiInfo = array('supid' => $infoobj->supid, 'uid' => 0, 'opuserid' => 0, 'cid' => $infoobj->cid, 'pid' => $infoobj->pid, 'cate2' => $cate2, 'cate3' => $infoobj->cate3, 'procate' => $procate, 'score' => $infoobj->star, 'ptype' => 1); Statistic::report(Statistic::SUP_DEL_PRODUCT, $tongjiInfo); } $infoobj->state = -7; $infoobj->online = 0; $re1 = $infoobj->save(); if ($re1 == false) { $this->di['gcproinfo']->rollback(); return $this->outputData(false, '600', '删除失败'); } $groupAll = \Gcproinfo\Models\PdPidgid::find(array("conditions" => 'pid=:pid: and cid = :cid: and state in (0,1)', 'bind' => array('pid' => $v1, 'cid' => $cid)))->toArray(); if (!empty($groupAll)) { foreach ($groupAll as $val) { $userGroupObj = \Gcproinfo\Models\PdPidgid::findFirst(array('id = :id:', 'bind' => array('id' => $val['id']))); $re2 = $userGroupObj->delete(); if ($re2 == false) { $this->di['gcproinfo']->rollback(); return $this->outputData(false, '600', '产品分组删除失败'); } if (empty($val['cgid'])) { $groupobj = \Gcproinfo\Models\Pdcustomgroup::findFirst(array('cid=:cid: and gid = :gid: and parentgid=0', 'bind' => array('gid' => $val['gid'], 'cid' => $val['cid']))); } else { $groupobj = \Gcproinfo\Models\Pdcustomgroup::findFirst(array('cid=:cid: and gid = :cgid: and parentgid=:gid:', 'bind' => array('cgid' => $val['cgid'], 'gid' => $val['gid'], 'cid' => $val['cid']))); } if (!empty($groupobj) && is_object($groupobj)) { if ($groupobj->pronum > 0) { $groupobj->pronum = $groupobj->pronum - 1; $re3 = $groupobj->save(); if ($re3 == false) { $this->di['gcproinfo']->rollback('产品分组统计产品数目失败'); return $this->outputData(false, '600', '产品分组统计产品数目失败'); } } } } } $this->di['gcsupplier']->begin(); $mProduct = \Gcproinfo\Models\Mproduct::findFirst(array('pid = :pid:', 'bind' => array('pid' => $v1))); if ($mProduct) { $re5 = $mProduct->delete(); if ($re5 == false) { $this->di['gcsupplier']->rollback(); return $this->outputData(false, '600', '违规产品删除失败'); } } $optimize = \Gcproinfo\Models\Pdoptimize::findFirst(array('pid = :pid:', 'bind' => array('pid' => $v1))); if ($optimize) { $optimize->state = -7; $re6 = $optimize->save(); if ($re6 == false) { $this->di['gcproinfo']->rollback(); return $this->outputData(false, '600', '待优化删除失败'); } } $this->di['gcproinfo']->commit(); $this->di['gcsupplier']->commit(); $rabbit = new RabbitMQ($this->di['config']->rabbitmq_write->toArray()); $rabbit->setBroadcast('v3prodesc', 'prodesc', json_encode(array('pid' => $infoobj->pid, 'cid' => $infoobj->cid, 'table' => 'product', 'op' => 'delete'))); } return $this->outputData(1); }
/** * 设置审核信息 * @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); }
public static function getData(array $codes, array $params) { Statistic::addPageLog(true); $logEvent = []; $logUrl = []; $logRuntime = []; $logState = []; $sqlArr = []; $result = []; foreach ($codes as $code) { $result['1_' . $code] = false; self::parseDataRequest($code, $params, $sqlArr); } $sqls = self::createDataSqls($sqlArr); $result = self::parseDataResult($sqls, $result); foreach ($result as $k => $v) { $logEvent[$k] = $k; $logRuntime[$k] = 0; $logUrl[$k] = ''; $logState[$k] = true; } Statistic::addPageLog(false, 'local', 'getData', $logEvent, $logState, $logUrl, $logRuntime); return $result; }
/** * 删除特权商品 * @param array $pid 商品id * @param int $supid 供应商id */ public function delGoods($pid, $supid = 0) { $supid = intval($supid); if (empty($pid) or !is_array($pid)) { return $this->outputData(false, 600, '参数有误'); } $di = \Phalcon\Di::getDefault(); foreach ($pid as $v) { if (empty($supid)) { $condition = 'pid=:pid:'; $where = 'pid=' . $v; $bind['pid'] = $v; } else { $condition = 'supid=:supid: and pid=:pid:'; $where = 'supid=' . $supid . ' and pid=' . $v; $bind['supid'] = $supid; $bind['pid'] = $v; } $info = Pdspecialpro::findFirst(array("conditions" => $condition, "bind" => $bind)); if ($info) { if ($info->state == 1 or $info->state == -2 or $info->state == -3) { //商品统计开始 if ($info->cate5 > 0) { $procate = $info->cate5; } elseif ($info->cate4 > 0) { $procate = $info->cate4; } else { $procate = $info->cate3; } $cate2 = 0; $comInfo = ComService::getInstance()->getComBySupid($info->supid); if ($comInfo['code'] == 200 and is_array($comInfo['data'])) { $cate2 = $comInfo['data']['cate2']; } $uid = 0; $opuserid = 0; $OpSup = OpSupService::getInstance()->getCompanyOpInfo($info->supid, $info->cate3); if ($OpSup['code'] == 200 and is_array($OpSup['data'])) { $opuserid = $OpSup['data']['opuserid']; $uid = $OpSup['data']['uid']; } $tongjiInfo = array('supid' => $info->supid, 'uid' => $uid, 'opuserid' => $opuserid, 'cid' => $info->cid, 'pid' => $info->pid, 'cate2' => $cate2, 'cate3' => $info->cate3, 'procate' => $procate, 'score' => $info->star, 'ptype' => 2); Statistic::report(Statistic::SUP_DEL_PRODUCT, $tongjiInfo); //商品统计结束 } $state = $info->state; $info->state = -7; $rs = $info->save(); $rabbit = new RabbitMQ($this->di['config']->rabbitmq_write->toArray()); if ($rs) { //删除索引 UserSearchService::getInstance()->deleteSpecial((int) $info->pid, (int) $info->cid); $di->getShared('gcproinfo')->update('pd_optimize', array('state'), array(-7), $where); $di->getShared('gcsupplier')->update('m_product', array('state'), array(-7), $where); $temp = Mspecialpro::findFirst(array("conditions" => $condition, "bind" => $bind)); if ($temp) { if ($temp->state == $state) { $temp->state = -7; $temp->save(); //删除索引 UserSearchService::getInstance()->deleteMSpecial((int) $temp->id, (int) $info->cid); $rabbit->setBroadcast('v3prodesc', 'prodesc', json_encode(array('pid' => $temp->id, 'cid' => $temp->cid, 'table' => 'mspecial', 'op' => 'delete'))); } } $rabbit->setBroadcast('v3product', 'product', json_encode(array('pid' => $info->pid, 'cid' => $info->cid))); $rabbit->setBroadcast('v3prodesc', 'prodesc', json_encode(array('pid' => $info->pid, 'cid' => $info->cid, 'table' => 'product', 'op' => 'delete'))); if ($info->is_op == 1) { //统计4.0的商品添加 马杰超 OpSupService::getInstance()->addStatic($info->cate3, $info->supid, 3); } } } } return $this->outputData(1); }