| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <?php
- /**
- * Created by PhpStorm.
- * User: wangming
- * Date: 2019/1/22
- * Time: 21:34
- */
- class Common_guest{
- public function __construct()
- {
- }
- static public function getInfoById($id)
- {
- $Table_common_guest = new Table_common_guest();
- return $Table_common_guest->getInfoById($id);
- }
- static public function getInfoByPhone($phone)
- {
- $Table_common_guest = new Table_common_guest();
- return $Table_common_guest->getInfoByPhone($phone);
- }
- static public function getInfoByOpenId($openId)
- {
- $Table_common_guest = new Table_common_guest();
- return $Table_common_guest->getInfoByOpenId($openId);
- }
- static public function generateNewCode($id)
- {
- $Table_common_guest = new Table_common_guest();
- return $Table_common_guest->generateNewCode($id);
- }
- static public function getPassInfo($id)
- {
- $guest = self::getInfoById($id);
- if (empty($guest)) {
- return 0;
- }
- //没有编号先生成编号
- if (empty($guest['code'])) {
- $newCode = self::generateNewCode($id);
- $updateAttr = array(
- 'code' => $newCode,
- );
- self::update($id, $updateAttr);
- }
- //增加一次次数
- $countAttr = array(
- 'count' => $guest['count'] + 1,
- );
- self::update($id, $countAttr);
- //返回是否可以入场标记
- $ret['id'] = $id;
- $ret['type'] = 1; //1-普通客户 2-经销商客户
- $ret['msg'] = '允许入场';
- $guest = self::getInfoById($id);
- $ret['code'] = $guest['code'];
- $ret['addtime'] = GetDateString($guest['addtime'], true);
- return $ret;
- }
- static public function add($attrs)
- {
- $Table_common_guest = new Table_common_guest();
- $id = $Table_common_guest->add($attrs);
- return $id;
- }
- static public function edit($id, $attrs)
- {
- $Table_common_guest = new Table_common_guest();
- return $Table_common_guest->edit($id, $attrs);
- }
- static public function update($id, $attrs)
- {
- $Table_common_guest = new Table_common_guest();
- return $Table_common_guest->update($id, $attrs);
- }
- static public function del($id)
- {
- $Table_common_guest = new Table_common_guest();
- return $Table_common_guest->del($id);
- }
- static public function getList($filter = array(), $count=0, $page=0, $pageSize=0)
- {
- $Table_common_guest = new Table_common_guest();
- return $Table_common_guest->getList($filter, $count, $page, $pageSize);
- }
- static public function getListByPage($filter = array(), $page=0, $pagesize=0){
- $Table_common_guest = new Table_common_guest();
- return $Table_common_guest->getList($filter, 0, $page, $pagesize);
- }
- static public function getCountAll($filter = array()){
- $Table_common_guest = new Table_common_guest();
- return $Table_common_guest->getList($filter, 1);
- }
- }
|