Recharge.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | A3Mall
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2020 http://www.a3-mall.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: xzncit <158373108@qq.com>
  8. // +----------------------------------------------------------------------
  9. namespace app\admin\service\order;
  10. use app\admin\service\Service;
  11. use app\admin\model\users\UsersRechange as UsersRechangeModel;
  12. class Recharge extends Service {
  13. public static function getList($data){
  14. $condition = [];
  15. $key = $data["key"]??[];
  16. $arr = ["users_rechange.order_no","users.username"];
  17. if((isset($key["type"]) && isset($arr[$key["type"]])) && !empty($key["title"])){
  18. $condition[] = [$arr[$key["type"]],"like",'%'.$key["title"].'%'];
  19. }
  20. $count = UsersRechangeModel::withJoin(["users"])->where($condition)->count();
  21. $result = array_map(function ($res){
  22. $res["username"] = getUserName($res);
  23. return $res;
  24. },UsersRechangeModel::withJoin(["users"])->where($condition)->order("id","desc")->page($data["page"]??1,$data["limit"]??10)->select()->toArray());
  25. return ["count"=>$count, "data"=>$result];
  26. }
  27. /**
  28. * 删除
  29. * @param $id
  30. * @return bool
  31. */
  32. public static function delete($id){
  33. return UsersRechangeModel::where("id",$id)->delete();
  34. }
  35. }