## 交接班记录
>[info] 功能:
1,显示数据:通过 `record_succession` 员工交接表 关联 `shop_users` 记录员工账号当天从登录到退出的 营收金额
/*
* 插入交接班记录信息
*
* /
static function saveForm(){
$data = post_data();
if(!$data['spare']){
exit(json_encode(['status'=>0,'msg'=>__('请输入备用金') ]));
}
$date['end_time'] = time();
$date['cash_payments'] = $data['cash_payments'];
$date['unionpay_pay'] = $data['unionpay_pay'];
$date['weixin_pay'] = $data['weixin_pay'];
$date['alipay_pay'] = $data['alipay_pay'];
/* $date['wp_users_pay'] = $data['wp_users_pay'];*/
$date['standby_money'] = $data['spare'];
$info = record_succession::where('id',cookie('record_succession_id'))->update($date);
return $info;
}
/*
* 插入登录时间用户信息
*
* /
static function login_time_info($one){
$two = self::where('shop_users_id',$one->id)
->where('yf_shop_base_id',$one->yf_shop_base_id)
->where('start_time','>=',strtotime(date('Y-m-d')))
->first();
if(!$two){
$data['shop_users_id'] = $one->id;
$data['yf_shop_base_id'] = $one->yf_shop_base_id;
$data['start_time'] = time();
$id = self::insertGetId($data);
cookie('record_succession_id',$id);
cookie('first_login_time',date('Y-m-d H:i',time()));
}else{
cookie('record_succession_id',$two->id);
cookie('first_login_time',date('Y-m-d H:i',$two->start_time));
}
}
/*
* 员工交接班信息数据显示
*
* /
static public function shop_shift(){
/*
* 获取订单数据
*
* /
$order_list = wp_order::where('shop_users_id',cookie('id'))
->where('shop_id',cookie('shop_id'))
->where('created','>=',strtotime(date('Y-m-d')))
->where('type','!=',1)
->where('order_status',6)
->get();
$cash_payments_num = 0;
$unionpay_pay_num = 0;
$weixin_pay_num = 0;
$alipay_pay_num = 0;
/*$wp_users_pay_num = 0;*/
foreach($order_list as $k=>$v){
if($v->payid == config('payment.cash')){
$cash_payments_num += $v->good_price;
}elseif($v->payid == config('payment.unionpay')){
$unionpay_pay_num += $v->good_price;
}elseif($v->payid == config('payment.wepay')){
$weixin_pay_num += $v->good_price;
}elseif($v->payid == config('payment.alipay')){
$alipay_pay_num += $v->good_price;
}
}