You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
199 lines
3.5 KiB
199 lines
3.5 KiB
<?php
|
|
namespace app\massage\model;
|
|
|
|
use app\BaseModel;
|
|
use think\facade\Db;
|
|
|
|
class OrderAddress extends BaseModel
|
|
{
|
|
//定义表名
|
|
protected $name = 'massage_service_order_address';
|
|
|
|
|
|
|
|
|
|
|
|
public function getMobileAttr($value,$data){
|
|
|
|
if(!empty($value)&&isset($data['uniacid'])){
|
|
|
|
if(numberEncryption($data['uniacid'])==1){
|
|
|
|
return substr_replace($value, "****", 2,4);
|
|
}
|
|
|
|
}
|
|
|
|
return $value;
|
|
|
|
}
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2020-09-29 11:04
|
|
* @功能说明:添加
|
|
*/
|
|
public function dataAdd($data){
|
|
|
|
$res = $this->insert($data);
|
|
|
|
return $res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2020-09-29 11:05
|
|
* @功能说明:编辑
|
|
*/
|
|
public function dataUpdate($dis,$data){
|
|
|
|
$res = $this->where($dis)->update($data);
|
|
|
|
return $res;
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2020-09-29 11:06
|
|
* @功能说明:列表
|
|
*/
|
|
public function dataList($dis,$page){
|
|
|
|
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2020-09-29 11:43
|
|
* @功能说明:
|
|
*/
|
|
public function dataInfo($dis){
|
|
|
|
$data = $this->where($dis)->find();
|
|
|
|
return !empty($data)?$data->toArray():[];
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-22 10:34
|
|
* @功能说明:添加下单地址
|
|
*/
|
|
public function orderAddressAdd($address,$order_id,$coach_info=[]){
|
|
|
|
if(empty($address)){
|
|
|
|
return ['code'=>500,'msg'=>'下单地址已删除'];
|
|
|
|
}
|
|
|
|
$insert = [
|
|
|
|
'uniacid' => $address['uniacid'],
|
|
|
|
'order_id' => $order_id,
|
|
|
|
'user_name'=> $address['user_name'],
|
|
|
|
'mobile' => $address['mobile'],
|
|
|
|
'province' => $address['province'],
|
|
|
|
'city' => $address['city'],
|
|
|
|
'area' => $address['area'],
|
|
|
|
'lng' => $address['lng'],
|
|
|
|
'lat' => $address['lat'],
|
|
|
|
'address' => $address['address'],
|
|
|
|
'address_id' => !empty($address['id'])?$address['id']:0,
|
|
|
|
'address_info' => $address['address_info'],
|
|
|
|
'coach_lng' => !empty($coach_info['lng'])?$coach_info['lng']:'',
|
|
|
|
'coach_lat' => !empty($coach_info['lat'])?$coach_info['lat']:'',
|
|
|
|
'coach_address'=> !empty($coach_info['address'])?$coach_info['address']:'',
|
|
|
|
];
|
|
|
|
$res = $this->dataAdd($insert);
|
|
|
|
if($res!=1){
|
|
|
|
return ['code'=>500,'msg'=>'下单失败'];
|
|
|
|
}
|
|
|
|
return $res;
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @param $uniacid
|
|
* @param $user_name
|
|
* @param $phone
|
|
* @功能说明:
|
|
* @author chenniang
|
|
* @DataTime: 2023-04-03 16:08
|
|
*/
|
|
public function getDefaultSetting($uniacid,$user_name,$phone,$store_id){
|
|
|
|
$store_model = new \app\store\model\StoreList();
|
|
|
|
$store = $store_model->dataInfo(['id'=>$store_id]);
|
|
|
|
if(empty($store)){
|
|
|
|
return false;
|
|
}
|
|
|
|
$insert = [
|
|
|
|
'uniacid' => $uniacid,
|
|
|
|
'user_name'=> $user_name,
|
|
|
|
'mobile' => $phone,
|
|
|
|
'province' => '',
|
|
|
|
'city' => '',
|
|
|
|
'area' => '',
|
|
|
|
'lng' => $store['lng'],
|
|
|
|
'lat' => $store['lat'],
|
|
|
|
'address' => $store['address'],
|
|
|
|
'address_info' => '',
|
|
|
|
];
|
|
|
|
return $insert;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |