diff --git a/app/Controller/v3/BalanceStatementController.php b/app/Controller/v3/BalanceStatementController.php new file mode 100644 index 0000000..a8a03c7 --- /dev/null +++ b/app/Controller/v3/BalanceStatementController.php @@ -0,0 +1,21 @@ +request->all(); + return $this->success($this->revenueListService->check(46)); + } +} \ No newline at end of file diff --git a/app/Controller/v3/CollectStoreController.php b/app/Controller/v3/CollectStoreController.php index 6f26b1e..8f13dca 100644 --- a/app/Controller/v3/CollectStoreController.php +++ b/app/Controller/v3/CollectStoreController.php @@ -28,4 +28,11 @@ class CollectStoreController extends BaseController } return $this->success($res); } + + public function getListByUser() + { + $params = $this->request->all(); + $res = $this->collectStoreService->getListByUser($params['user_id']); + return $this->success($res); + } } \ No newline at end of file diff --git a/app/Model/v3/FinancialRecord.php b/app/Model/v3/FinancialRecord.php new file mode 100644 index 0000000..ace1d98 --- /dev/null +++ b/app/Model/v3/FinancialRecord.php @@ -0,0 +1,101 @@ +=100是提现消费等支出项 + */ + const MONEY_TYPE_CS_PLAT_NEW_USER = 1; // 社区服务点新用户奖励(线上订单完成) + const MONEY_TYPE_CS_FIRST_ORDER = 2; // 社区服务点新用户线上首单奖励(线上订单完成) + const MONEY_TYPE_CS_OL_ORDER = 3; // 社区服务点用户线上订单分账(线上订单完成) + const MONEY_TYPE_STORE_PLAT_NEW_USER = 4; // 商户平台新用户奖励 + const MONEY_TYPE_STORE_FIRST_ORDER = 5; // 商户当日首单奖励 + const MONEY_TYPE_STORE_OL_ORDER_COMP = 6; // 商户线上订单完成收入 + const MONEY_TYPE_STORE_OFL_ORDER_COMP = 7; // 商户线下订单完成收入 + const MONEY_TYPE_USER_OL_ORDER_REFUND = 8; // 用户线上订单退款 + + const MONEY_TYPE_USER_OFL_ORDER = 100; // 用户线下支付订单 + const MONEY_TYPE_USER_OL_ORDER = 101; // 用户线上支付订单 + + /** + * 状态 + */ + const STATUS_NORMAL = 1; + const STATUS_ABNORMAL = 2; + + /** + * The table associated with the model. + * + * @var string + */ + protected $table = 'lanzu_financial_record'; + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = [ + 'user_id', + 'user_type', + 'money', + 'money_type', + 'source_id', + 'source_type', + 'desc', + 'comment', + 'status', + ]; + /** + * The attributes that should be cast to native types. + * + * @var array + */ + protected $casts = []; +} \ No newline at end of file diff --git a/app/Model/v3/Market.php b/app/Model/v3/Market.php index 5fffc33..fa92f9e 100644 --- a/app/Model/v3/Market.php +++ b/app/Model/v3/Market.php @@ -7,4 +7,9 @@ use App\Model\Model; class Market extends Model { protected $table = 'lanzu_market'; + + public function stores() + { + return $this->hasMany(Store::class,'market_id','id'); + } } \ No newline at end of file diff --git a/app/Service/v3/Implementations/CollectStoreService.php b/app/Service/v3/Implementations/CollectStoreService.php index aa6da92..6ef94c1 100644 --- a/app/Service/v3/Implementations/CollectStoreService.php +++ b/app/Service/v3/Implementations/CollectStoreService.php @@ -1,9 +1,12 @@ exec('get',SsdbKeys::COUNT_COLLECT_STORE.$storeId); return $count; } + + public function getListByUser($userId) + { + $marketIds = Db::table('lanzu_user_collection')->where('user_id',$userId)->pluck('market_id')->toArray(); + $storeIds = Db::table('lanzu_user_collection')->where('user_id',$userId)->pluck('store_id')->toArray(); + $res = Market::query()->with(['stores' => function($query) use ($storeIds) { + $query->whereIn('lanzu_store.id',$storeIds); + }]) + ->whereIn('id',$marketIds) + ->get(); + return $res; + } } \ No newline at end of file diff --git a/app/Service/v3/Implementations/RevenueListService.php b/app/Service/v3/Implementations/RevenueListService.php new file mode 100644 index 0000000..aefe342 --- /dev/null +++ b/app/Service/v3/Implementations/RevenueListService.php @@ -0,0 +1,28 @@ +suffix($mod); + return $financialRecord::query()->get(); + } + + public function undo() + { + // TODO: Implement undo() method. + } +} \ No newline at end of file diff --git a/app/Service/v3/Interfaces/CollectStoreServiceInterface.php b/app/Service/v3/Interfaces/CollectStoreServiceInterface.php index 36917a2..25f0c4a 100644 --- a/app/Service/v3/Interfaces/CollectStoreServiceInterface.php +++ b/app/Service/v3/Interfaces/CollectStoreServiceInterface.php @@ -13,4 +13,6 @@ interface CollectStoreServiceInterface public function countByUser($userId); public function countByStore($storeId); + + public function getListByUser($userId); } \ No newline at end of file diff --git a/app/Service/v3/Interfaces/RevenueListServiceInterface.php b/app/Service/v3/Interfaces/RevenueListServiceInterface.php new file mode 100644 index 0000000..0dfc696 --- /dev/null +++ b/app/Service/v3/Interfaces/RevenueListServiceInterface.php @@ -0,0 +1,14 @@ + \App\Service\v3\Implementations\TabsService::class, \App\Service\v3\Interfaces\LocationServiceInterface::class => \App\Service\v3\Implementations\LocationService::class, \App\Service\v3\Interfaces\GoodsActivityServiceInterface::class => \App\Service\v3\Implementations\GoodsActivityService::class, + \App\Service\v3\Interfaces\RevenueListServiceInterface::class => \App\Service\v3\Implementations\RevenueListService::class, ]; diff --git a/config/routes.php b/config/routes.php index 9939e49..fa3e8df 100644 --- a/config/routes.php +++ b/config/routes.php @@ -112,4 +112,6 @@ Router::addGroup('/v3/', function () { Router::post('home/storeIndex', 'App\Controller\v3\HomeController@storeIndex'); Router::post('orderList/onlineForStore', 'App\Controller\v3\OrderListController@onlineForStore'); Router::post('orderList/offlineForStore', 'App\Controller\v3\OrderListController@offlineForStore'); + Router::post('collectStore/getListByUser', 'App\Controller\v3\CollectStoreController@getListByUser'); + Router::post('balanceStatement/getRevenueListByUser', 'App\Controller\v3\BalanceStatementController@getRevenueListByUser'); },['middleware' => [\App\Middleware\Auth\ApiMiddleware::class, \App\Middleware\Auth\UserMiddleware::class]]); \ No newline at end of file