diff --git a/api/controllers/plan/Bobing.php b/api/controllers/plan/Bobing.php index 5ccc71c2..19debccc 100644 --- a/api/controllers/plan/Bobing.php +++ b/api/controllers/plan/Bobing.php @@ -78,7 +78,7 @@ class Bobing extends HD_Controller } /** - * Notes:马甲跑分数 + * Notes:马甲总积分跑分数 * Created on: 2021/9/8 11:59 * Created by: dengbw * https://liche-api-dev.xiaoyu.com/plan/bobing/mj @@ -127,4 +127,68 @@ class Bobing extends HD_Controller echo 'uid(' . $uid . ')本次加分失败了'; } } + + /** + * Notes:马甲每日积分跑分数 + * Created on: 2021/9/14 11:59 + * Created by: dengbw + * https://liche-api-dev.xiaoyu.com/plan/bobing/mj_day + * https://api.liche.cn/plan/bobing/mj_day + */ + public function mj_day() + { + $hour = date('H'); + if ($hour < 9 || $hour > 22) { + echo '9点到22点博'; + return; + } + if ($this->appConfig['game_start_date'] > date('Y-m-d H:i')) { + echo '博饼未开始'; + return; + } + if ($this->appConfig['game_end_date'] < date('Y-m-d H:i')) { + echo '博饼已结束'; + return; + } + $uids = array( + '2021-09-14' => [3007, 3008, 3009, 3010, 3011], '2021-09-15' => [3012, 3013, 3014, 3015, 3016], + '2021-09-16' => [3017, 3018, 3019, 3020, 3021], '2021-09-17' => [3022, 3023, 3024, 3025, 3026], + '2021-09-18' => [3027, 3028, 3029, 3030, 3031], '2021-09-19' => [3032, 3033, 3034, 3035, 3036], + '2021-09-20' => [3037, 3038, 3039, 3040, 3041], '2021-09-21' => [3042, 3043, 3044, 3045, 3046], + '2021-09-22' => [3047, 3048, 3049, 3050, 3051], '2021-09-23' => [3052, 3053, 3054, 3055, 3056], + '2021-09-24' => [3057, 3058, 3059, 3060, 3061], '2021-09-25' => [3062, 3063, 3064, 3065, 3066], + '2021-09-26' => [3067, 3068, 3069, 3070, 3071], '2021-09-27' => [3072, 3073, 3074, 3075, 3076], + '2021-09-28' => [3077, 3078, 3079, 3080, 3081], '2021-09-29' => [3082, 3083, 3084, 3085, 3086], + '2021-09-30' => [3087, 3088, 3089, 3090, 3091], '2021-10-01' => [3092, 3093, 3094, 3095, 3096], + '2021-10-02' => [3097, 3098, 3099, 3100, 3101], '2021-10-03' => [3102, 3103, 3104, 3105, 3106], + '2021-10-04' => [3107, 3108, 3109, 3110, 3111], '2021-10-05' => [3112, 3113, 3114, 3115, 3116], + '2021-10-06' => [3117, 3118, 3119, 3120, 3121], '2021-10-07' => [3122, 3123, 3124, 3125, 3126], + '2021-10-08' => [3127, 3128, 3129, 3130, 3131]); + $credits = array(1 => 30, 2 => 50, 3 => 60, 4 => 70, 5 => 50, 6 => 30, 7 => 20, 8 => 15); + $date = date('Y-m-d'); + $uids_day = $uids[$date]; + foreach ($uids_day as $key => $value) { + $where = array('app_id' => $this->appConfig['app_id'], 'act_key' => $this->appConfig['act_key']); + $uid = $value; + $credit = $credits[rand(1, 8)]; + $where['uid'] = $uid; + $re_bu = $this->mdBobingUser->get($where); + if ($re_bu) { + $this->mdBobingUser->update(array("credit = credit+{$credit}" => null), $where); + } else { + $addUser = array_merge($where, array('c_time' => time(), 'credit' => $credit)); + $this->mdBobingUser->add($addUser); + } + $where['bo_date'] = date('Y-m-d'); + $re_u = $this->mdBobingUserCredit->get($where); + if ($re_u) { + $this->mdBobingUserCredit->update(array("credit = credit+{$credit}" => null), $where); + } else { + $where['credit'] = $credit; + $where['c_time'] = time(); + $this->mdBobingUserCredit->add($where); + } + echo 'uid(' . $uid . ')本次加了:' . $credit . ',今天总分:' . ($re_u['credit'] + $credit) . '
'; + } + } } diff --git a/api/controllers/plan/Plan.php b/api/controllers/plan/Plan.php index e564c9c1..13493c65 100644 --- a/api/controllers/plan/Plan.php +++ b/api/controllers/plan/Plan.php @@ -27,7 +27,8 @@ class Plan extends CI_Controller //执行失败的plan重跑 $plan[] = array('url' => base_url(array('plan', 'plan', 'replan')), 'interval' => 1); $plan[] = array('url' => base_url(array('plan', 'bobing', 'lottery')), 'interval' => 30);//博饼每日中奖 - //$plan[] = array('url' => base_url(array('plan', 'bobing', 'mj')), 'interval' => 30);//马甲跑分数 + //$plan[] = array('url' => base_url(array('plan', 'bobing', 'mj')), 'interval' => 30);//马甲跑总分数 + $plan[] = array('url' => base_url(array('plan', 'bobing', 'mj_day')), 'interval' => 30);//马甲跑今日分数 $this->plan = $plan; } diff --git a/api/controllers/wxapp/bobing/Bobing.php b/api/controllers/wxapp/bobing/Bobing.php index 741a8afc..460abdc6 100644 --- a/api/controllers/wxapp/bobing/Bobing.php +++ b/api/controllers/wxapp/bobing/Bobing.php @@ -326,17 +326,17 @@ class Bobing extends Wxapp $addUser = array_merge($where, array('c_time' => time())); $this->mdBobingUser->add($addUser); //添加购物金 - $re_au = $this->app_user_model->get(array('id' => $this->myuid)); - if ($re_au['unionid']) { - $this->load->model('app/app_wechatqy_model', 'mdWechatqy'); - $re_wx = $this->mdWechatqy->get(array('unionid' => $re_au['unionid'], 'app_id' => $this->appConfig['app_id'])); - if ($re_wx) {//有加企业微信 - $this->app_user_model->update(array('wxqy' => 1), array('id' => $re_au['id'])); - $this->load->library('bobing/bo'); - $this->bo->uid = $this->myuid; - $this->bo->wxqy_car_gold(); //加购物金 - } - } +// $re_au = $this->app_user_model->get(array('id' => $this->myuid)); +// if ($re_au['unionid']) { +// $this->load->model('app/app_wechatqy_model', 'mdWechatqy'); +// $re_wx = $this->mdWechatqy->get(array('unionid' => $re_au['unionid'], 'app_id' => $this->appConfig['app_id'])); +// if ($re_wx) {//有加企业微信 +// $this->app_user_model->update(array('wxqy' => 1), array('id' => $re_au['id'])); +// $this->load->library('bobing/bo'); +// $this->bo->uid = $this->myuid; +// $this->bo->wxqy_car_gold(); //加购物金 +// } +// } } return $re_u; } diff --git a/api/controllers/wxapp/bobing/Home.php b/api/controllers/wxapp/bobing/Home.php index 07f1332b..7c70f3a3 100644 --- a/api/controllers/wxapp/bobing/Home.php +++ b/api/controllers/wxapp/bobing/Home.php @@ -500,17 +500,17 @@ class Home extends Wxapp $addUser = array_merge($where, array('c_time' => time())); $this->mdBobingUser->add($addUser); //添加购物金 - $re_au = $this->app_user_model->get(array('id' => $this->myuid)); - if ($re_au['unionid']) { - $this->load->model('app/app_wechatqy_model', 'mdWechatqy'); - $re_wx = $this->mdWechatqy->get(array('unionid' => $re_au['unionid'], 'app_id' => $this->appConfig['app_id'])); - if ($re_wx) {//有加企业微信 - $this->app_user_model->update(array('wxqy' => 1), array('id' => $re_au['id'])); - $this->load->library('bobing/bo'); - $this->bo->uid = $this->myuid; - $this->bo->wxqy_car_gold(); //加购物金 - } - } +// $re_au = $this->app_user_model->get(array('id' => $this->myuid)); +// if ($re_au['unionid']) { +// $this->load->model('app/app_wechatqy_model', 'mdWechatqy'); +// $re_wx = $this->mdWechatqy->get(array('unionid' => $re_au['unionid'], 'app_id' => $this->appConfig['app_id'])); +// if ($re_wx) {//有加企业微信 +// $this->app_user_model->update(array('wxqy' => 1), array('id' => $re_au['id'])); +// $this->load->library('bobing/bo'); +// $this->bo->uid = $this->myuid; +// $this->bo->wxqy_car_gold(); //加购物金 +// } +// } } return $re_u; }