|
@@ -217,7 +217,7 @@ class AlbumController extends Controller
|
|
['agent_id', $userAuth->up_agent_id],['open_id', $check->open_id],['store_id', $datas['store_id']]
|
|
['agent_id', $userAuth->up_agent_id],['open_id', $check->open_id],['store_id', $datas['store_id']]
|
|
])->first();
|
|
])->first();
|
|
$check_user = AlbumWatchRecord::where([
|
|
$check_user = AlbumWatchRecord::where([
|
|
- ['open_id', $check->open_id],['store_id', $datas['store_id']]
|
|
|
|
|
|
+ ['open_id', $check->open_id],['store_id', $datas['store_id']]
|
|
])->first();
|
|
])->first();
|
|
\Log::info($check_user);
|
|
\Log::info($check_user);
|
|
|
|
|
|
@@ -226,11 +226,11 @@ class AlbumController extends Controller
|
|
} else {
|
|
} else {
|
|
$add_record['is_new'] = 1;
|
|
$add_record['is_new'] = 1;
|
|
}
|
|
}
|
|
- // \Log::info($add_record);
|
|
|
|
|
|
+ // \Log::info($add_record);
|
|
AlbumWatchRecord::create($add_record);
|
|
AlbumWatchRecord::create($add_record);
|
|
- // dd($add_record);
|
|
|
|
|
|
+ // dd($add_record);
|
|
$user_agent = AlbumAgentModel::where([['id',$add_record['agent_id']],['store_id',$datas['store_id']]])->first();
|
|
$user_agent = AlbumAgentModel::where([['id',$add_record['agent_id']],['store_id',$datas['store_id']]])->first();
|
|
- // dd($user_agent);
|
|
|
|
|
|
+ // dd($user_agent);
|
|
if ($user_agent) {
|
|
if ($user_agent) {
|
|
if (empty($check_new_customer)) {
|
|
if (empty($check_new_customer)) {
|
|
$user_agent->get_count++;
|
|
$user_agent->get_count++;
|
|
@@ -333,9 +333,7 @@ class AlbumController extends Controller
|
|
public function albumGoods(Request $request)
|
|
public function albumGoods(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if (!$userAuth) {
|
|
|
|
- return $this->error(ErrorCode::ERROR_POWER, '登陆过期!');
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'cat_id' => 'required',
|
|
'cat_id' => 'required',
|
|
'parent_id' => 'required',
|
|
'parent_id' => 'required',
|
|
@@ -486,17 +484,15 @@ class AlbumController extends Controller
|
|
{
|
|
{
|
|
// $userAuth = AlbumXyxUserModel::find(1);
|
|
// $userAuth = AlbumXyxUserModel::find(1);
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if (!$userAuth) {
|
|
|
|
- return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'goods_id' => 'required',
|
|
'goods_id' => 'required',
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
- // 'parent_id' => 'required',
|
|
|
|
|
|
+ // 'parent_id' => 'required',
|
|
], [
|
|
], [
|
|
'goods_id.required' => '缺少商品参数',
|
|
'goods_id.required' => '缺少商品参数',
|
|
'store_id.required' => '缺少STORE参数',
|
|
'store_id.required' => '缺少STORE参数',
|
|
- // 'parent_id.required' => '缺少PARENT参数',
|
|
|
|
|
|
+ // 'parent_id.required' => '缺少PARENT参数',
|
|
]);
|
|
]);
|
|
if ($validator->fails()) {
|
|
if ($validator->fails()) {
|
|
return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
|
|
return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
|
|
@@ -638,9 +634,7 @@ class AlbumController extends Controller
|
|
public function albumFavoriteList(Request $request)
|
|
public function albumFavoriteList(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if (!$userAuth) {
|
|
|
|
- return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
], [
|
|
], [
|
|
@@ -704,9 +698,7 @@ class AlbumController extends Controller
|
|
public function albumGetWatchRecord(Request $request)
|
|
public function albumGetWatchRecord(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if (!$userAuth) {
|
|
|
|
- return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
'type' => 'required'
|
|
'type' => 'required'
|
|
@@ -848,9 +840,7 @@ class AlbumController extends Controller
|
|
public function albumGetDataGoods(Request $request)
|
|
public function albumGetDataGoods(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if (!$userAuth) {
|
|
|
|
- return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required'
|
|
'store_id' => 'required'
|
|
], [
|
|
], [
|
|
@@ -928,9 +918,7 @@ class AlbumController extends Controller
|
|
public function albumGetDataCat(Request $request)
|
|
public function albumGetDataCat(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if (!$userAuth) {
|
|
|
|
- return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
'parent_id' => 'required'
|
|
'parent_id' => 'required'
|
|
@@ -1005,9 +993,7 @@ class AlbumController extends Controller
|
|
public function albumGetDataCatSingle(Request $request)
|
|
public function albumGetDataCatSingle(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if (!$userAuth) {
|
|
|
|
- return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
'open_id' => 'required',
|
|
'open_id' => 'required',
|
|
@@ -1105,9 +1091,7 @@ class AlbumController extends Controller
|
|
public function albumGetCartOfWatch(Request $request)
|
|
public function albumGetCartOfWatch(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if (!$userAuth) {
|
|
|
|
- return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
'end' => 'required',
|
|
'end' => 'required',
|
|
@@ -1241,7 +1225,7 @@ class AlbumController extends Controller
|
|
{
|
|
{
|
|
//$userAuth = AlbumXyxUserModel::find(1);
|
|
//$userAuth = AlbumXyxUserModel::find(1);
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
'favorite_id' => 'required',
|
|
'favorite_id' => 'required',
|
|
@@ -1307,7 +1291,7 @@ class AlbumController extends Controller
|
|
public function albumSaveFormId(Request $request)
|
|
public function albumSaveFormId(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
'form_id' => 'required',
|
|
'form_id' => 'required',
|
|
@@ -1366,7 +1350,7 @@ class AlbumController extends Controller
|
|
public function albumAddFavorite(Request $request)
|
|
public function albumAddFavorite(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
'product_id' => 'required',
|
|
'product_id' => 'required',
|
|
@@ -1643,7 +1627,7 @@ class AlbumController extends Controller
|
|
public function albumSavePhone(Request $request)
|
|
public function albumSavePhone(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
'code' => 'required',
|
|
'code' => 'required',
|
|
@@ -1729,7 +1713,7 @@ class AlbumController extends Controller
|
|
public function albumSetWatch(Request $request)
|
|
public function albumSetWatch(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
'type' => 'required',
|
|
'type' => 'required',
|
|
@@ -1885,11 +1869,11 @@ class AlbumController extends Controller
|
|
\Log::info($value);\Log::info('2225');
|
|
\Log::info($value);\Log::info('2225');
|
|
if ($open_id && !empty($weChatApp->wxaccount_template_id) && (!$value || ($value + 60) <= time())) {
|
|
if ($open_id && !empty($weChatApp->wxaccount_template_id) && (!$value || ($value + 60) <= time())) {
|
|
Cache::put($open_id, time(), 1);
|
|
Cache::put($open_id, time(), 1);
|
|
- /* $config = [
|
|
|
|
- 'app_id' => $weChatApp->G_app_id,
|
|
|
|
- 'secret' => $weChatApp->G_app_secret,
|
|
|
|
- 'response_type' => 'array',
|
|
|
|
- ];*/
|
|
|
|
|
|
+ /* $config = [
|
|
|
|
+ 'app_id' => $weChatApp->G_app_id,
|
|
|
|
+ 'secret' => $weChatApp->G_app_secret,
|
|
|
|
+ 'response_type' => 'array',
|
|
|
|
+ ];*/
|
|
|
|
|
|
$ac = $this->getAccessToken($weChatApp);
|
|
$ac = $this->getAccessToken($weChatApp);
|
|
$url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=" . $ac;
|
|
$url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=" . $ac;
|
|
@@ -1909,28 +1893,28 @@ class AlbumController extends Controller
|
|
"keyword1" => array( "value" => $name, "color" => "#93c47d" ),
|
|
"keyword1" => array( "value" => $name, "color" => "#93c47d" ),
|
|
"keyword2" => array( "value" => $date, "color" => "#0000ff" ),
|
|
"keyword2" => array( "value" => $date, "color" => "#0000ff" ),
|
|
"remark" => array( "value" => $content, "color" => "#0000ff" ),
|
|
"remark" => array( "value" => $content, "color" => "#0000ff" ),
|
|
- // "remark" => array( "value" => $date, "color" => "#45818e" )
|
|
|
|
|
|
+ // "remark" => array( "value" => $date, "color" => "#45818e" )
|
|
)
|
|
)
|
|
)
|
|
)
|
|
);
|
|
);
|
|
$data = json_encode($data, JSON_UNESCAPED_UNICODE);
|
|
$data = json_encode($data, JSON_UNESCAPED_UNICODE);
|
|
$res = $this->curlPost($url, $data);
|
|
$res = $this->curlPost($url, $data);
|
|
$res = json_decode($res, true);
|
|
$res = json_decode($res, true);
|
|
- /* $app = Factory::officialAccount($config);
|
|
|
|
- $res = $app->template_message->send([
|
|
|
|
- 'touser' => $g_open_id,
|
|
|
|
- 'template_id' => $weChatApp->wxaccount_template_id,
|
|
|
|
- 'url' => '',
|
|
|
|
- 'data' => [
|
|
|
|
- 'keyword1' => $name,
|
|
|
|
- 'keyword2' => $content,
|
|
|
|
- 'keyword3' => date('Y-m-d H:i'),
|
|
|
|
- ],
|
|
|
|
- 'miniprogram' => [
|
|
|
|
- 'appid' => $weChatApp->app_id,
|
|
|
|
- 'pagepath' => 'pages/sell/sell'
|
|
|
|
- ],
|
|
|
|
- ]);*/
|
|
|
|
|
|
+ /* $app = Factory::officialAccount($config);
|
|
|
|
+ $res = $app->template_message->send([
|
|
|
|
+ 'touser' => $g_open_id,
|
|
|
|
+ 'template_id' => $weChatApp->wxaccount_template_id,
|
|
|
|
+ 'url' => '',
|
|
|
|
+ 'data' => [
|
|
|
|
+ 'keyword1' => $name,
|
|
|
|
+ 'keyword2' => $content,
|
|
|
|
+ 'keyword3' => date('Y-m-d H:i'),
|
|
|
|
+ ],
|
|
|
|
+ 'miniprogram' => [
|
|
|
|
+ 'appid' => $weChatApp->app_id,
|
|
|
|
+ 'pagepath' => 'pages/sell/sell'
|
|
|
|
+ ],
|
|
|
|
+ ]);*/
|
|
return $res;
|
|
return $res;
|
|
} else {
|
|
} else {
|
|
return false;
|
|
return false;
|
|
@@ -2004,7 +1988,7 @@ class AlbumController extends Controller
|
|
public function albumAddAgent(Request $request)
|
|
public function albumAddAgent(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'realname' => 'required',
|
|
'realname' => 'required',
|
|
'address' => 'required',
|
|
'address' => 'required',
|
|
@@ -2096,7 +2080,7 @@ class AlbumController extends Controller
|
|
public function albumGetAgentAdress(Request $request)
|
|
public function albumGetAgentAdress(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
],[
|
|
],[
|
|
@@ -2156,8 +2140,6 @@ class AlbumController extends Controller
|
|
|
|
|
|
public function albumGetBanner(Request $request)
|
|
public function albumGetBanner(Request $request)
|
|
{
|
|
{
|
|
- $userAuth = Auth('api')->user();
|
|
|
|
- if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
],[
|
|
],[
|
|
@@ -2211,7 +2193,7 @@ class AlbumController extends Controller
|
|
public function albumGetCustomer(Request $request)
|
|
public function albumGetCustomer(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
'open_id'=>'required'
|
|
'open_id'=>'required'
|
|
@@ -2283,7 +2265,7 @@ class AlbumController extends Controller
|
|
public function albumSetCustomer(Request $request)
|
|
public function albumSetCustomer(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
'key' => 'required',
|
|
'key' => 'required',
|
|
@@ -2361,7 +2343,7 @@ class AlbumController extends Controller
|
|
public function albumCustomerGoods(Request $request)
|
|
public function albumCustomerGoods(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
'open_id' => 'required',
|
|
'open_id' => 'required',
|
|
@@ -2443,9 +2425,7 @@ class AlbumController extends Controller
|
|
public function albumCustomerGoodsDetail(Request $request)
|
|
public function albumCustomerGoodsDetail(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if (!$userAuth) {
|
|
|
|
- return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
'open_id' => 'required',
|
|
'open_id' => 'required',
|
|
@@ -2559,7 +2539,7 @@ class AlbumController extends Controller
|
|
public function albumGetCountOfFavorite(Request $request)
|
|
public function albumGetCountOfFavorite(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
],[
|
|
],[
|
|
@@ -2628,7 +2608,7 @@ class AlbumController extends Controller
|
|
public function albumGetUserInfo(Request $request)
|
|
public function albumGetUserInfo(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
|
|
+
|
|
if($userAuth->is_dealer == 1){
|
|
if($userAuth->is_dealer == 1){
|
|
$user_agent = AlbumAgentModel::where([['user_id',$userAuth->id],['status',1]])->first();
|
|
$user_agent = AlbumAgentModel::where([['user_id',$userAuth->id],['status',1]])->first();
|
|
$agent_id = $user_agent['id'];
|
|
$agent_id = $user_agent['id'];
|
|
@@ -2671,7 +2651,7 @@ class AlbumController extends Controller
|
|
public function albumStatistical(Request $request)
|
|
public function albumStatistical(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
],[
|
|
],[
|
|
@@ -2750,7 +2730,7 @@ class AlbumController extends Controller
|
|
public function albumGetStatistical(Request $request)
|
|
public function albumGetStatistical(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
'open_id' => 'required',
|
|
'open_id' => 'required',
|
|
@@ -2850,7 +2830,7 @@ class AlbumController extends Controller
|
|
public function albumAgentPriceSet(Request $request)
|
|
public function albumAgentPriceSet(Request $request)
|
|
{
|
|
{
|
|
$userAuth = Auth('api')->user();
|
|
$userAuth = Auth('api')->user();
|
|
- if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
|
|
|
|
+
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
'is_show_ma_price' => 'required',
|
|
'is_show_ma_price' => 'required',
|
|
'store_id' => 'required',
|
|
'store_id' => 'required',
|
|
@@ -2870,7 +2850,7 @@ class AlbumController extends Controller
|
|
$user_agent->save();
|
|
$user_agent->save();
|
|
|
|
|
|
|
|
|
|
- $product = AlbumProductModel::where('store_id',$data['store_id'])->get(['id','ma_price']);
|
|
|
|
|
|
+ $product = AlbumProductModel::where('store_id',$data['store_id'])->get(['id','cat_id','name','ma_price']);
|
|
foreach ($product as $key=>$val) {
|
|
foreach ($product as $key=>$val) {
|
|
$save['price'] = $val['ma_price'] * (1 + $data['point'] / 100);
|
|
$save['price'] = $val['ma_price'] * (1 + $data['point'] / 100);
|
|
$check = AlbumProductPriceModel::where([['agent_id',$user_agent->id],['store_id',$data['store_id']],['product_id',$val['id']]])->first();
|
|
$check = AlbumProductPriceModel::where([['agent_id',$user_agent->id],['store_id',$data['store_id']],['product_id',$val['id']]])->first();
|