调整订单

This commit is contained in:
2023-01-28 11:24:20 +08:00
parent 9f44774e86
commit 7861309d83
5 changed files with 27 additions and 8 deletions

View File

@@ -42,6 +42,9 @@ class TestController extends Controller
$tables = [ $tables = [
'admin_operation_log', 'admin_operation_log',
'area_stocks',
'area_codes',
'area_clerks',
'favorites', 'favorites',
'cms_logs', 'cms_logs',
'failed_jobs', 'failed_jobs',

View File

@@ -106,8 +106,17 @@ class IndexController extends Controller
* @param Request $request * @param Request $request
* @return JsonResponse|mixed * @return JsonResponse|mixed
*/ */
public function generate(Area $area, Request $request) public function generate(Request $request)
{ {
$area = Area::query()
->whereHas('areaClerks', function ($q) {
$q->where('user_id', Api::userId());
})
->first();
if (! $area) {
return $this->failed('您没有管理的区域无法查看');
}
$res = $area->generate(Api::userId(), $request->num); $res = $area->generate(Api::userId(), $request->num);
if ($res === true) { if ($res === true) {
return $this->success('生成成功'); return $this->success('生成成功');

View File

@@ -30,14 +30,14 @@ class IndexController extends Controller
$centers = Banner::query()->ofPosition(Banner::POSITION_INDEX_CENTER)->get(); $centers = Banner::query()->ofPosition(Banner::POSITION_INDEX_CENTER)->get();
$show_goods_id = app('Conf_mall')['show_goods_id'] ?? 0; $show_goods_id = app('Conf_mall')['show_score_goods_id'] ?? 0;
$show_goods = ''; $show_goods = '';
if ($show_goods_id > 0) { if ($show_goods_id > 0) {
$show_goods = Goods::find($show_goods_id); $show_goods = Goods::find($show_goods_id);
} }
$goods = Goods::query() $goods = Goods::query()
->where('id', '<>', $show_goods_id) // ->where('id', '<>', $show_goods_id)
->shown() ->shown()
->where('channel', Goods::CHANNEL_SCORE) ->where('channel', Goods::CHANNEL_SCORE)
->get(); ->get();

View File

@@ -79,10 +79,10 @@ trait HasOrders
], ],
//积分兑换 //积分兑换
'score' => [ 'score' => [
'all' => $this->orders()->scopeTypeScore()->common()->count(), 'all' => $this->orders()->typescore()->common()->count(),
'paid' => $this->orders()->scopeTypeScore()->paid()->count(), 'paid' => $this->orders()->typescore()->paid()->count(),
'unpay' => $this->orders()->scopeTypeScore()->unpay()->count(), 'unpay' => $this->orders()->typescore()->unpay()->count(),
'delivered' => $this->orders()->scopeTypeScore()->delivered()->count(), 'delivered' => $this->orders()->typescore()->delivered()->count(),
], ],
]; ];
} }

View File

@@ -310,7 +310,14 @@ class User extends Authenticate
return sprintf("%s (%s)", $this->username, $this->info->nickname); return sprintf("%s (%s)", $this->username, $this->info->nickname);
} }
public function areas() /**
* Notes: 管理的区域
*
* @Author: 玄尘
* @Date: 2023/1/28 9:32
* @return BelongsToMany
*/
public function areas(): BelongsToMany
{ {
return $this->belongsToMany( return $this->belongsToMany(
Area::class, Area::class,