UserMonthService.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: z-yang
  5. * Date: 2019/7/27
  6. * Time: 18:01
  7. */
  8. namespace App\Modules\User\Services;
  9. use App\Modules\User\Models\UserMonthOrder;
  10. use App\Modules\User\Models\UserMonthSign;
  11. class UserMonthService
  12. {
  13. public static function createSign(int $uid, int $plan_id, string $change_type)
  14. {
  15. $model = new UserMonthSign();
  16. $info = $model->where('uid', $uid)->where('plan_id', $plan_id)->first();
  17. if ($info) {
  18. $info->change_type = $change_type;
  19. $info->save();
  20. } else {
  21. $model->uid = $uid;
  22. $model->plan_id = $plan_id;
  23. $model->change_type = $change_type;
  24. $model->save();
  25. }
  26. return;
  27. }
  28. public static function createLOrder(int $uid, int $plan_id, int $total_fee, string $trade_no)
  29. {
  30. $model = new UserMonthOrder();
  31. $model->uid = $uid;
  32. $model->plan_id = $plan_id;
  33. $model->total_fee = $total_fee;
  34. $model->trade_no = $trade_no;
  35. $model->save();
  36. return;
  37. }
  38. }