init: import production code mss.nahaichuan.com (exclude Runtime/Uploads/backups/logs)
这个提交包含在:
@@ -0,0 +1,162 @@
|
||||
<?php
|
||||
|
||||
namespace Common\Model;
|
||||
//[1.8.50]
|
||||
|
||||
/**
|
||||
* 小程序用户表
|
||||
* Class RetailSmallProgramUserModel
|
||||
* @package Common\Model
|
||||
*/
|
||||
class RetailSmallProgramUserModel extends BaseModel
|
||||
{
|
||||
protected $tableName = 'retail_xcxvip';
|
||||
const ID = 'id'; //int(11) NOT NULL AUTO_INCREMENT,
|
||||
const OPENID = 'openid'; //varchar(255) DEFAULT '0',
|
||||
const NICKNAME = 'nickname'; //varchar(30) DEFAULT NULL COMMENT '昵称',
|
||||
const AVATAR = 'avatar'; //varchar(255) DEFAULT NULL COMMENT '微信头像',
|
||||
const MERCHANT_ID = 'merchant_id'; //int(11) DEFAULT NULL COMMENT '商户id',
|
||||
const ADD_TIME = 'add_time'; //varchar(255) DEFAULT NULL COMMENT '注册时间',
|
||||
const VID = 'vid'; //int(11) DEFAULT NULL COMMENT '与会员表id关联的字段',
|
||||
const PLUS_VIP_ID = 'plus_vip_id'; //int(11) DEFAULT NULL COMMENT '与会员表id关联的字段',
|
||||
const MOBILE_PHONE = 'mobile_phone'; //varchar(11) DEFAULT NULL COMMENT '自提最近使用手机号',
|
||||
const LINK_NAME = 'link_name'; //varchar(50) DEFAULT NULL COMMENT '自提最近使用姓名',
|
||||
const USER_TYPE = 'type'; //tinyint(1) DEFAULT '1' COMMENT '1普通成员 2plus会员',
|
||||
const GUIDE_ID = 'guide_id'; //tinyint(1) DEFAULT '1' COMMENT '导购员id',
|
||||
const SERVICE_OPENID = 'service_openid'; //在服务商下的openid,
|
||||
const ORDINARY_OPENID = 'ordinary_openid'; //商户公众号下的openid,
|
||||
const STORE_ID = 'store_id'; //所属门店id,
|
||||
|
||||
|
||||
/*-----------------------以下为其他功能-----------------------------------*/
|
||||
|
||||
public function getFindVip($uid)
|
||||
{
|
||||
$user = $this->where(array('id' => $uid))->find();
|
||||
if (!$user || empty($user['vip_id'])) {
|
||||
$res['status'] = 0;
|
||||
$res['msg'] = '未绑定会员';
|
||||
} else {
|
||||
$map = array(
|
||||
'id' => $user['vip_id'],
|
||||
'merchantid' => $user['merchantid']
|
||||
);
|
||||
$vip = D('Vip')->getFind($map);
|
||||
if (!empty($vip)) {
|
||||
switch ($vip['status']) {
|
||||
case '1':
|
||||
$res['vip'] = $vip;
|
||||
$res['status'] = 1;
|
||||
$res['msg'] = '获取会员信息成功';
|
||||
break;
|
||||
case '2':
|
||||
$res['status'] = 0;
|
||||
$res['msg'] = '会员已被删除';
|
||||
break;
|
||||
case '3':
|
||||
$res['status'] = 0;
|
||||
$res['msg'] = '会员已被冻结';
|
||||
break;
|
||||
case '4':
|
||||
$res['status'] = 0;
|
||||
$res['msg'] = '该会员已挂失';
|
||||
break;
|
||||
default:
|
||||
$res['status'] = 0;
|
||||
$res['msg'] = '会员不存在';
|
||||
}
|
||||
} else {
|
||||
$res['status'] = 0;
|
||||
$res['msg'] = '会员不存在';
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
/*
|
||||
* retail_xcxvip和ls_retail_vip连表查
|
||||
*/
|
||||
public function getVip($where, $field)
|
||||
{
|
||||
// $user = M('retail_xcxvip as x')
|
||||
// ->join('ls_retail_vip as v on v.id=x.vip_id')
|
||||
// ->where(array('x.id'=>$uid,'v.status'=>array('neq',2)))
|
||||
// ->field('x.*,v.status as v_status')
|
||||
// ->find();
|
||||
$user = $this->alias('x')
|
||||
->join('ls_retail_vip as v on v.id=x.' . $this::VID)
|
||||
->where($where)
|
||||
->field($field)
|
||||
->find();
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序用户
|
||||
* @param $fields
|
||||
* @param $where
|
||||
* @param $page
|
||||
* @param $limit
|
||||
* @return mixed
|
||||
*/
|
||||
public function getXcxUserList($fields, $where, $page, $limit)
|
||||
{
|
||||
$list = $this->alias('x')
|
||||
->join('ls_retail_vip as v on x.vid=v.id', 'LEFT')
|
||||
->field($fields)
|
||||
->where($where)
|
||||
->page($page, $limit)
|
||||
->order('x.id desc')
|
||||
->select();
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序用户总数
|
||||
* @param $fields
|
||||
* @param $where
|
||||
* @param $page
|
||||
* @param $limit
|
||||
* @return mixed
|
||||
*/
|
||||
public function getXcxUserCount($where)
|
||||
{
|
||||
$count = $this->alias('x')
|
||||
->join('ls_retail_vip as v on x.vid=v.id', 'LEFT')
|
||||
->where($where)
|
||||
->count();
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取代理商信息
|
||||
* @param $where
|
||||
* @param $fields
|
||||
*/
|
||||
public function getAgentPaySet($fields,$where)
|
||||
{
|
||||
$agent = $this->alias('x')
|
||||
->join('ls_retail_merchant as m on x.merchant_id=m.id')
|
||||
->join('ls_retail_agent as a on m.agentid=a.id')
|
||||
->field($fields)
|
||||
->where($where)
|
||||
->find();
|
||||
return $agent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商户公众号信息
|
||||
* @param $where
|
||||
* @param $fields
|
||||
*/
|
||||
public function getMerchantPaySet($fields,$where)
|
||||
{
|
||||
$agent = $this->alias('x')
|
||||
->join('ls_wxconfig as w on w.merchantid=x.merchant_id')
|
||||
->field($fields)
|
||||
->where($where)
|
||||
->find();
|
||||
return $agent;
|
||||
}
|
||||
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户