alias('r') ->join('ls_shop_coupon as s on r.coupon_id=s.id') ->field($fields) ->where($where) ->find(); return $info; } /** * 发放记录 * @param $fields * @param $where * @param $page * @param $limit * @return mixed */ public function recordList($fields, $where, $page, $limit) { $list = $this->alias('r') ->join('ls_shop_coupon as c on r.coupon_id=c.id') ->join('ls_retail_xcxvip as x on r.xcx_id=x.id') ->join('ls_retail_vip as v on x.vid=v.id', 'LEFT') ->join('ls_retail_store as s on r.store_id = s.id', 'LEFT') ->join('ls_retail_cashier as j on r.operator_id=j.id', 'LEFT') ->field($fields) ->where($where) ->page($page, $limit) ->order('r.id desc') ->select(); return $list; } /** * 发放记录总数 * @param $where * @return mixed */ public function recordCount($where) { $count = $this->alias('r') ->join('ls_shop_coupon as c on r.coupon_id=c.id') ->join('ls_retail_xcxvip as x on r.xcx_id=x.id') ->join('ls_retail_vip as v on x.vid=v.id', 'LEFT') ->join('ls_retail_store as s on r.verification_store_id = s.id', 'LEFT') ->join('ls_jurisdiction_user as j on r.operator_id=j.id', 'LEFT') ->where($where) ->count(); return $count; } /** * 用户的商家券列表分页 * @param $fields * @param $where * @param $page * @param $limit * @return mixed */ public function userCouponList($fields, $where, $page, $limit) { $list = $this->alias('s') ->join('ls_shop_coupon as c on s.coupon_id=c.id') ->field($fields) ->where($where) ->page($page, $limit) ->order('s.id desc') ->select(); return $list; } /** * 用户的商家券列表无分页 * @param $fields * @param $where * @return mixed */ public function PlaceOrderCouponList($fields, $where) { $info = $this->alias('r') ->join('ls_shop_coupon as s on r.coupon_id=s.id') ->field($fields) ->where($where) ->order('r.id desc') ->select(); return $info; } /** * 根据的用户商家券的id获取服务商下的openid * @param $fields * @param $where * @return mixed */ public function basisIdGetOpenid($fields='x.service_openid,x.openid',$where) { $xcx_info = $this->alias('s') ->join('ls_retail_xcxvip as x on s.xcx_id=x.id') ->field($fields) ->where($where) ->find(); return $xcx_info; } }