mirror of
https://github.com/crmeb/CRMEB.git
synced 2025-12-15 13:22:51 +00:00
53 lines
1.2 KiB
PHP
53 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
*
|
|
* @author: xaboy<365615158@qq.com>
|
|
* @day: 2017/12/21
|
|
*/
|
|
|
|
namespace app\routine\model\user;
|
|
|
|
use app\routine\model\store\StoreCouponUser;
|
|
use basic\ModelBasic;
|
|
use service\SystemConfigService;
|
|
use traits\ModelTrait;
|
|
/**
|
|
* 微信用户model
|
|
* Class WechatUser
|
|
* @package app\routine\model\user
|
|
*/
|
|
class WechatUser extends ModelBasic
|
|
{
|
|
use ModelTrait;
|
|
|
|
public static function getOpenId($uid = ''){
|
|
if($uid == '') return false;
|
|
return self::where('uid',$uid)->value('routine_openid');
|
|
}
|
|
/**
|
|
* 用uid获得openid
|
|
* @param $uid
|
|
* @return mixed
|
|
*/
|
|
public static function uidToOpenid($uid)
|
|
{
|
|
$openid = self::where('uid',$uid)->value('routine_openid');
|
|
return $openid;
|
|
}
|
|
|
|
/**
|
|
* 用openid获得uid
|
|
* @param $uid
|
|
* @return mixed
|
|
*/
|
|
public static function openidTouid($openid)
|
|
{
|
|
return self::where('routine_openid',$openid)->value('uid');
|
|
}
|
|
|
|
public static function userTakeOrderGiveCoupon($uid)
|
|
{
|
|
$couponId = SystemConfigService::get('store_order_give_coupon');
|
|
if($couponId) StoreCouponUser::addUserCoupon($uid,$couponId);
|
|
}
|
|
} |