Qc.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace app\api\controller;
  3. use app\api\controller\WeChart;
  4. use think\Db;
  5. class Qc{
  6. function index()
  7. {
  8. $sql = "SELECT uid , count(id) as num FROM `user_sign` where `month` = 11 GROUP BY uid HAVING num > 6 ORDER BY num desc";
  9. $list = Db::query($sql);
  10. foreach ($list as $lv)
  11. {
  12. $sign_data = Db::table('user_sign')
  13. ->where('uid',$lv['uid'])
  14. ->where('month','11')
  15. ->order('id asc')
  16. ->limit(7)
  17. ->select();
  18. $sign_data=[
  19. 'uid' =>$lv['uid'],
  20. 'year' =>$sign_data[6]['year'],
  21. 'month' =>$sign_data[6]['month'],
  22. 'day' =>$sign_data[6]['day'],
  23. 'type' =>'2',
  24. 'create_at' =>$sign_data[6]['create_at'],
  25. 'desc' => '恭喜亲通过累积签到7天获得10积分',
  26. 'integral' => 10,
  27. 'growth' => 10,
  28. 'set_id' => 2,
  29. ];
  30. Db::table('user_sign')->insert($sign_data);
  31. $int_id = Db::getLastInsID();
  32. update_user_integral($lv['uid'], 10,3,$sign_data['desc'],$int_id);
  33. update_user_growth($lv['uid'],10,3,'恭喜亲通过累积签到7天获得10成长值');
  34. }
  35. }
  36. }