|
@@ -35,8 +35,8 @@ class OrderService
|
|
|
}
|
|
|
|
|
|
if (!$list->isEmpty()) {
|
|
|
- $status = array_column(self::getOrderPayType(),null,'value');
|
|
|
- $types = array_column(self::getOrderType(),null,'value');
|
|
|
+ $status = array_column(self::getOrderPayType(), null, 'value');
|
|
|
+ $types = array_column(self::getOrderType(), null, 'value');
|
|
|
foreach ($list as $val) {
|
|
|
$val->username = $val->user_id > 0 ? User::where('id', $val->user_id)->value('username') : "";
|
|
|
$val->company_name = "-";
|
|
@@ -55,7 +55,7 @@ class OrderService
|
|
|
$val->caompany_count = Order::where('uid', $val->uid)->where('puser_id', '>', 0)->count();
|
|
|
$val->promotion_count = Order::where('uid', $val->uid)->where('user_id', '>', 0)->count();
|
|
|
}
|
|
|
- $val->tip_text = $types[$val->order_type]['name']?? "-";
|
|
|
+ $val->tip_text = $types[$val->order_type]['name'] ?? "-";
|
|
|
$val->status_txt = $status[$val->status]['name'] ?? "-";
|
|
|
$val->pay_name = '微信支付';
|
|
|
}
|
|
@@ -67,20 +67,20 @@ class OrderService
|
|
|
public static function getOrderType()
|
|
|
{
|
|
|
return [
|
|
|
- ["value" => "COIN","name" => "普通充值"],
|
|
|
- ["value" => 'MONTH',"name" => '包月'],
|
|
|
- ["value" => 'QUARTER' ,"name"=> '包季'],
|
|
|
- ["value" => 'YEAR' ,"name"=> '包年'],
|
|
|
- ["value" => "FIRST_COIN" ,"name" => "首充"]
|
|
|
+ ["value" => "COIN", "name" => "普通充值"],
|
|
|
+ ["value" => 'MONTH', "name" => '包月'],
|
|
|
+ ["value" => 'QUARTER', "name" => '包季'],
|
|
|
+ ["value" => 'YEAR', "name" => '包年'],
|
|
|
+ ["value" => "FIRST_COIN", "name" => "首充"]
|
|
|
];
|
|
|
}
|
|
|
|
|
|
public static function getOrderPayType()
|
|
|
{
|
|
|
return [
|
|
|
- ["value" => "PAID","name" => "已支付"],
|
|
|
- ["value" =>'REFUND',"name" => '已退款'],
|
|
|
- ["value" =>'UNPAID' ,"name"=> '未支付'],
|
|
|
+ ["value" => "PAID", "name" => "已支付"],
|
|
|
+ ["value" => 'REFUND', "name" => '已退款'],
|
|
|
+ ["value" => 'UNPAID', "name" => '未支付'],
|
|
|
];
|
|
|
}
|
|
|
|
|
@@ -151,20 +151,26 @@ class OrderService
|
|
|
* @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection
|
|
|
* date 2023/05/23 17:51
|
|
|
*/
|
|
|
- public static function userUseProgramsList(mixed $uid)
|
|
|
+ public static function userUseProgramsList(mixed $uid, $name = "", $limit = 20)
|
|
|
{
|
|
|
|
|
|
$operateUser = User::find($uid);
|
|
|
$operateUserRoles = $operateUser->roles->pluck('identify');
|
|
|
-
|
|
|
if ($operateUserRoles->contains('company') || $operateUserRoles->contains('optimizer')) {
|
|
|
- return UserHasMiniprograms::query()->join('miniprogram', 'miniprogram.id', '=', 'user_has_miniprograms.miniprogram_id')
|
|
|
+ $list = UserHasMiniprograms::query()->join('miniprogram', 'miniprogram.id', '=', 'user_has_miniprograms.miniprogram_id')
|
|
|
->where('uid', $uid)
|
|
|
->groupBy("user_has_miniprograms.miniprogram_id")
|
|
|
- ->select('user_has_miniprograms.miniprogram_id', 'miniprogram.name', 'miniprogram.play_name')
|
|
|
- ->get();
|
|
|
+ ->select('user_has_miniprograms.miniprogram_id', 'miniprogram.name', 'miniprogram.play_name');
|
|
|
+ if ($name) {
|
|
|
+ $list->where('name', "like", "%" . $name . "%");
|
|
|
+ }
|
|
|
+ return $list->limit($limit)->get();
|
|
|
} else {
|
|
|
- return DB::table('miniprogram')->select("id as miniprogram_id", "name", "play_name")->get();
|
|
|
+ if ($name) {
|
|
|
+ return DB::table('miniprogram')->where('name', "like", "%" . $name . "%")->select("id as miniprogram_id", "name", "play_name")->limit($limit)->get();
|
|
|
+ }
|
|
|
+ return DB::table('miniprogram')->select("id as miniprogram_id", "name", "play_name")->limit($limit)->get();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -177,7 +183,7 @@ class OrderService
|
|
|
* @return \Illuminate\Support\Collection
|
|
|
* date 2023/05/23 18:13
|
|
|
*/
|
|
|
- public static function promotionsOptions(mixed $uid, mixed $title)
|
|
|
+ public static function promotionsOptions(mixed $uid, mixed $title,$limit = 10)
|
|
|
{
|
|
|
$operateUser = User::find($uid);
|
|
|
$operateUserRoles = $operateUser->roles->pluck('identify');
|
|
@@ -186,20 +192,20 @@ class OrderService
|
|
|
if ($title) {
|
|
|
$list->where('name', 'like', "%" . $title . "%");
|
|
|
}
|
|
|
- return $list->where('uid', $uid)->get();
|
|
|
+ return $list->where('uid', $uid)->limit($limit)->get();
|
|
|
} else if ($operateUserRoles->contains('company')) {
|
|
|
- $list = DB::table('promotions')->join('users','users.id',"promotions.uid")
|
|
|
- ->where('users.pid',$uid)->orWhere("promotions.uid",$uid)->select("promotions.id as promotion_id ", 'promotions.name');
|
|
|
+ $list = DB::table('promotions')->join('users', 'users.id', "promotions.uid")
|
|
|
+ ->where('users.pid', $uid)->orWhere("promotions.uid", $uid)->select('promotions.id as promotion_id ', 'promotions.name');
|
|
|
if ($title) {
|
|
|
$list->where('promotions.name', 'like', "%" . $title . "%");
|
|
|
}
|
|
|
- return $list->get();
|
|
|
+ return $list->limit($limit)->get();
|
|
|
|
|
|
} else {
|
|
|
if ($title) {
|
|
|
$list->where('name', 'like', "%" . $title . "%");
|
|
|
}
|
|
|
- return $list->get();
|
|
|
+ return $list->limit($limit)->get();
|
|
|
}
|
|
|
}
|
|
|
}
|