You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
729 B
35 lines
729 B
<?php
|
|
|
|
namespace app\model;
|
|
|
|
use think\Model;
|
|
|
|
class WechatPucode extends Model
|
|
{
|
|
|
|
/**
|
|
* 添加pucode
|
|
* @param $user_id
|
|
* @param $pucode
|
|
* @return WechatPucode|array|mixed|Model
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException\
|
|
*/
|
|
public static function createPuCode($user_id,$pucode)
|
|
{
|
|
$data = [
|
|
'wechat_user_id' => $user_id,
|
|
'pucode' => $pucode
|
|
];
|
|
|
|
$query = self::where($data)->find();
|
|
if ($query) {
|
|
return $query;
|
|
}
|
|
|
|
$data['create_time'] = time();
|
|
|
|
return self::create($data);
|
|
}
|
|
}
|