14 changed files with 211 additions and 5 deletions
-
6app/Constants/v3/SsdbKeys.php
-
5app/Constants/v3/Tabs.php
-
8app/Controller/v3/GoodsRecommendController.php
-
57app/Controller/v3/HomeController.php
-
3app/Model/v3/User.php
-
36app/Request/v3/UserIndexRequest.php
-
12app/Service/v3/Implementations/CollectStoreService.php
-
41app/Service/v3/Implementations/CouponService.php
-
10app/Service/v3/Implementations/UserInfoService.php
-
2app/Service/v3/Interfaces/CollectStoreServiceInterface.php
-
31app/Service/v3/Interfaces/CouponServiceInterface.php
-
1app/Service/v3/Interfaces/UserInfoServiceInterface.php
-
1config/autoload/dependencies.php
-
3config/routes.php
@ -0,0 +1,36 @@ |
|||||
|
<?php |
||||
|
|
||||
|
declare(strict_types=1); |
||||
|
|
||||
|
namespace App\Request\v3; |
||||
|
|
||||
|
use App\Request\BaseFormRequest; |
||||
|
|
||||
|
class UserIndexRequest extends BaseFormRequest |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* Get the validation rules that apply to the request. |
||||
|
*/ |
||||
|
public function rules(): array |
||||
|
{ |
||||
|
return [ |
||||
|
'user_id' => 'required|nonempty|integer', |
||||
|
]; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @return array |
||||
|
*/ |
||||
|
public function messages(): array |
||||
|
{ |
||||
|
return [ |
||||
|
'*.*' => ':attribute无效', |
||||
|
]; |
||||
|
} |
||||
|
|
||||
|
public function attributes(): array |
||||
|
{ |
||||
|
return parent::attributes(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,41 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Service\v3\Implementations; |
||||
|
|
||||
|
use App\Service\v3\Interfaces\CouponServiceInterface; |
||||
|
|
||||
|
class CouponService implements CouponServiceInterface |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* @inheritDoc |
||||
|
*/ |
||||
|
public function do() |
||||
|
{ |
||||
|
// TODO: Implement do() method.
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @inheritDoc |
||||
|
*/ |
||||
|
public function check() |
||||
|
{ |
||||
|
// TODO: Implement check() method.
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @inheritDoc |
||||
|
*/ |
||||
|
public function undo() |
||||
|
{ |
||||
|
// TODO: Implement undo() method.
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @inheritDoc |
||||
|
*/ |
||||
|
public function countAvailableByUser($userId) |
||||
|
{ |
||||
|
return mt_rand(0,10); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Service\v3\Interfaces; |
||||
|
|
||||
|
interface CouponServiceInterface |
||||
|
{ |
||||
|
/** |
||||
|
* 领取 |
||||
|
* @return mixed |
||||
|
*/ |
||||
|
public function do(); |
||||
|
|
||||
|
/** |
||||
|
* 是否已经领取 |
||||
|
* @return mixed |
||||
|
*/ |
||||
|
public function check(); |
||||
|
|
||||
|
/** |
||||
|
* 退还优惠券 |
||||
|
* @return mixed |
||||
|
*/ |
||||
|
public function undo(); |
||||
|
|
||||
|
/** |
||||
|
* 统计用户可使用优惠券数量 |
||||
|
* @param $userId |
||||
|
* @return mixed |
||||
|
*/ |
||||
|
public function countAvailableByUser($userId); |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue