|
@@ -1052,7 +1052,7 @@ class AlbumController extends Controller
|
|
$checkAllstart = date('Y-m-d H:i:s',$checkAllstart);
|
|
$checkAllstart = date('Y-m-d H:i:s',$checkAllstart);
|
|
$checkAllend = date('Y-m-d H:i:s',$checkAllend);
|
|
$checkAllend = date('Y-m-d H:i:s',$checkAllend);
|
|
$count_today = AlbumWatchRecord::where([['agent_id',$user_agent->id],['store_id',$store_id],['updated_at','>=',$checkAllstart],['updated_at','<=',$checkAllend]])->groupBy('open_id')->count();
|
|
$count_today = AlbumWatchRecord::where([['agent_id',$user_agent->id],['store_id',$store_id],['updated_at','>=',$checkAllstart],['updated_at','<=',$checkAllend]])->groupBy('open_id')->count();
|
|
- $count_all = AlbumWatchRecord::where([['agent_id',$user_agent->id],['store_id',$store_id]])->groupBy('open_id')->count();
|
|
|
|
|
|
+ $count_all = AlbumWatchRecord::where([['agent_id',$user_agent->id],['store_id',$store_id]])->groupBy('open_id')->get();dd($count_all);
|
|
$count_share = $user_agent->share_times;
|
|
$count_share = $user_agent->share_times;
|
|
$users = Array();
|
|
$users = Array();
|
|
if($count_user){
|
|
if($count_user){
|
|
@@ -2147,16 +2147,19 @@ class AlbumController extends Controller
|
|
if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
|
|
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',
|
|
],[
|
|
],[
|
|
'store_id.required'=>'缺少商户参数',
|
|
'store_id.required'=>'缺少商户参数',
|
|
|
|
+ 'open_id.required'=>'缺少用户参数',
|
|
]);
|
|
]);
|
|
if ($validator->fails()) {
|
|
if ($validator->fails()) {
|
|
return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
|
|
return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
|
|
}
|
|
}
|
|
$store_id = $request->input('store_id');
|
|
$store_id = $request->input('store_id');
|
|
|
|
+ $open_id = $request->input('open_id');
|
|
if($userAuth->is_dealer!=1) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '该用户不是经销商!', $validator->messages());
|
|
if($userAuth->is_dealer!=1) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '该用户不是经销商!', $validator->messages());
|
|
$user_agent = AlbumAgentModel::where('user_id',$userAuth->id)->first();
|
|
$user_agent = AlbumAgentModel::where('user_id',$userAuth->id)->first();
|
|
- if($user_agent) $res= AlbumWatchRecord::where([['action',3],['store_id',$store_id],['agent_id',$user_agent->id]])->groupBy('detail')->get(['detail']);
|
|
|
|
|
|
+ if($user_agent) $res= AlbumWatchRecord::where([['action',3],['store_id',$store_id],['agent_id',$user_agent->id],['open_id',$open_id]])->groupBy('detail')->get(['detail']);
|
|
$arr = array();
|
|
$arr = array();
|
|
foreach ($res as $key=>$val){
|
|
foreach ($res as $key=>$val){
|
|
$detail = json_decode($val['detail'],true);
|
|
$detail = json_decode($val['detail'],true);
|
|
@@ -2164,7 +2167,7 @@ class AlbumController extends Controller
|
|
$goods_id = $detail['goods_id'];
|
|
$goods_id = $detail['goods_id'];
|
|
$goods = AlbumProductModel::where([['id',$goods_id]])->first();
|
|
$goods = AlbumProductModel::where([['id',$goods_id]])->first();
|
|
if($goods){
|
|
if($goods){
|
|
- $count= AlbumWatchRecord::where([['action',3],['store_id',$store_id],['detail',$val['detail']],['agent_id',$user_agent->id]])->count();
|
|
|
|
|
|
+ $count= AlbumWatchRecord::where([['action',3],['store_id',$store_id],['detail',$val['detail']],['agent_id',$user_agent->id],['open_id',$open_id]])->count();
|
|
|
|
|
|
$arr[] = ['name'=>$goods->name,'count'=>$count];
|
|
$arr[] = ['name'=>$goods->name,'count'=>$count];
|
|
}
|
|
}
|