|
@@ -378,7 +378,7 @@ class AppController extends Controller
|
|
|
$type = $request->get('type');
|
|
|
$day = $request->get('day');
|
|
|
$limit_amount = 20000;
|
|
|
- $limit_users = 20;
|
|
|
+// $limit_users = 20;
|
|
|
|
|
|
// 参数判断
|
|
|
if ((empty($openid) && empty($uid)) || empty($channel_id) || empty($type) || !in_array($type, ['coin', 'day'])) {
|
|
@@ -465,6 +465,14 @@ class AppController extends Controller
|
|
|
return response()->json(['code' => -1, 'msg' => '每个用户每个站点每日加书币的总额不得超过'.$limit_amount.'!']);
|
|
|
}
|
|
|
|
|
|
+ //商户书币限制
|
|
|
+ $sql = 'select app_id,today_user_numbers from company_auth_configs where id in(select company_id from channel_users where id in( select channel_user_id from distribution_channels where id='.$channel_id.'))';
|
|
|
+ $res = DB::connection('mysql')->select($sql);
|
|
|
+ if($res && isset($res[0]) && !empty($res[0]->today_user_numbers)){
|
|
|
+ $limit_users = $res[0]->today_user_numbers;
|
|
|
+ }else{
|
|
|
+ $limit_users = 20;
|
|
|
+ }
|
|
|
// 当日该站点加过书币的总用户数
|
|
|
$today_users = DB::connection('mysql')->table('user_coin_logs')->where(['distribution_channel_id'=>$channel_id, 'day'=>date('Y-m-d')])->groupBy(['uid'])->get()->pluck('uid')->toArray();
|
|
|
if (count($today_users) > $limit_users) return response()->json(['code' => -1, 'msg' => '每个站点每日加书币的用户数不得超过'.$limit_users.'!']);
|