| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace app\model;
- use think\Model;
- // 商户用户分数
- class MerchantsUserBalanceModel extends Model {
- protected $connection = 'fortue_tiger';
- // 设置表名(不含前缀)
- protected $name = 'merchants_user_balance';
- // 定义主键(默认为id)
- protected $pk = 'id';
- // 设置自动写入时间戳
- protected $autoWriteTimestamp = true;
- // 设置字段类型
- protected $type = [
- 'id' => 'int', // 自增ID
- 'user_id' => 'int', // 用户ID
- 'app_id' => 'int', // 商家ID
- 'uname' => 'int', // 平台用户的id 必须唯一
- 'balance' => 'decimal', // 分数
- 'hash' => 'string', // 分数 校验
- 'create_time' => 'int', // 创建时间
- 'update_time' => 'int', // 更新时间
- ];
- public static function getUsersBalanceList($app_id, $user_ids) {
- $where = [];
- $where[] = ['app_id', '=', $app_id];
- $where[] = ['user_id', 'in', $user_ids];
- $list = self::where($where)->select()->toArray();
- $user_config = array_column($list, null, 'user_id');
- return $user_config;
- }
- }
|