示例#1
0
 /**
  * 统计产品条数
  * @param  string  $condition 条件
  * @param  integer $type      选择数据表     默认1为正式表   2为M表
  * @param  array   $bind      条件
  * @return int             条数
  */
 public function productNum($condition, $type = 1, $bind = array())
 {
     if (empty($condition)) {
         return $this->outputData(0);
     }
     if ($type == 1) {
         $count = \Gcproinfo\Models\Pdinfo::count(array($condition, "bind" => $bind));
     } elseif ($type == 2) {
         $count = \Gcproinfo\Models\Mproduct::count(array($condition, "bind" => $bind));
     } elseif ($type == 3) {
         $count = \Gcproinfo\Models\Pdoptimize::count(array($condition, "bind" => $bind));
     } elseif ($type == 4) {
         $count = \Gcproinfo\Models\Pdspecialpro::count(array($condition, "bind" => $bind));
     } elseif ($type == 5) {
         $count = \Gcproinfo\Models\Mspecialpro::count(array($condition, "bind" => $bind));
     }
     return $this->outputData($count);
 }
示例#2
0
 /**
  * 获得单个未审核的商品详情
  * @param  ing $supid 供应商supid
  * @param  ing $pid   商品id
  * @param  ing $isdesc   是否要商品详情
  */
 public function getTempSpecialDetails($supid, $id, $isdesc = 0)
 {
     $supid = $this->di['filter']->sanitize($supid, 'int', 0);
     $id = $this->di['filter']->sanitize($id, 'int', 0);
     if (empty($supid) or empty($id)) {
         return $this->outputData(false, 600, '商品信息获取失败');
     }
     $goods = Mspecialpro::findFirst(array("conditions" => "id = :id: and supid = :supid:", "bind" => array('supid' => $supid, 'id' => $id)));
     if ($goods) {
         $goods = $goods->toArray();
         if (is_array($goods) && !empty($goods)) {
             if ($isdesc == 1) {
                 $obj = new \Gcproinfo\Models\Mspecialpro();
                 $desc = $obj->getDesc($id);
                 $goods['desc'] = '';
                 if (!empty($desc)) {
                     $goods['desc'] = $desc;
                 }
             }
             return $this->outputData($goods);
         }
     } else {
         return $this->outputData(false, 600, '商品信息获取失败');
     }
 }
示例#3
0
 /**
  * 特权商品数量
  * @param  int  $cid   供应商cid
  * @param  int  $is_op   1为状态0  2为状态1
  * @param  int $state   状态
  */
 public function getSpecialCount($cid = 0, $is_op = 0, $state = 100, $offset = 0, $limit = 20, $type = 1, $order = 'uptime desc')
 {
     $cid = $this->di['filter']->sanitize($cid, 'int', 0);
     $type = $this->di['filter']->sanitize($type, 'int', 0);
     $is_op = $this->di['filter']->sanitize($is_op, 'int', 0);
     $state = $this->di['filter']->sanitize($state, 'int', '0');
     if ($is_op == 1) {
         $is_op = 0;
     } elseif ($is_op == 2) {
         $is_op = 1;
     }
     $condition = 1;
     if (!empty($cid)) {
         $condition .= ' and cid = :cid:';
         $bind['cid'] = $cid;
     }
     if ($state == 100) {
         $condition .= ' and state !=0';
     } else {
         $condition .= ' and state =:state:';
         $bind['state'] = $state;
     }
     $condition .= ' and is_op=:is_op:';
     $bind['is_op'] = $is_op;
     if ($type == 1) {
         $count = Mspecialpro::count(array($condition, 'bind' => $bind));
         return $this->outputData($count);
     } elseif ($type == 2) {
         $data = Mspecialpro::find(array($condition, 'bind' => $bind, 'limit' => $limit, 'offset' => $offset, 'order' => $order))->toArray();
         $data['count'] = Mspecialpro::count(array($condition, 'bind' => $bind));
         return $this->outputData($data);
     }
 }
示例#4
0
 public function sphinxNotice($id, $type)
 {
     $rabbit = new RabbitMQ($this->di['config']->rabbitmq_write->toArray());
     if ($type == 1) {
         $obj = Pdspecialpro::findFirst(array('pid = :pid:', 'bind' => array('pid' => $id)));
         if ($obj == false) {
             return $this->outputData(1);
         }
         $sphinxInfo2 = array('id' => $obj->pid, 'supid' => $obj->supid, 'proname' => $obj->proname, 'cid' => $obj->cid, 'addtime' => $obj->addtime, 'uptime' => $obj->uptime, 'state' => $obj->state, 'online' => 1, 'groupid' => 0, 'cate1' => $obj->cate1, 'cate2' => $obj->cate2, 'cate3' => $obj->cate3, 'whichTable' => 2);
         $rabbit->set('v3search', 'prosearch', json_encode($sphinxInfo2), 'sphinxRT');
         $sphinxInfo3 = array('id' => $obj->pid, 'cid' => $obj->cid, 'supid' => $obj->supid, 'proname' => $obj->proname, 'addtime' => $obj->addtime, 'uptime' => $obj->uptime, 'star' => $obj->star, 'cate3' => $obj->cate3, 'state' => $obj->state, 'is_op' => $obj->is_op, 'ratio' => $obj->ratio, 'whichTable' => 3);
         $rabbit->set('v3search', 'prosearch', json_encode($sphinxInfo3), 'sphinxRT');
     } elseif ($type == 2) {
         $obj = Mspecialpro::findFirst(array('id = :id:', 'bind' => array('id' => $id)));
         if ($obj == false) {
             return $this->outputData(1);
         }
         $sphinxInfo4 = array('id' => $obj->id, 'cid' => $obj->cid, 'supid' => $obj->supid, 'proname' => $obj->proname, 'addtime' => $obj->addtime, 'uptime' => $obj->uptime, 'star' => $obj->star, 'cate3' => $obj->cate3, 'state' => $obj->state, 'is_op' => $obj->is_op, 'ratio' => $obj->ratio, 'whichTable' => 4);
         $rabbit->set('v3search', 'prosearch', json_encode($sphinxInfo4), 'sphinxRT');
     }
 }