setter
parent
0d1631cbb9
commit
4daeae6f34
|
@ -53,7 +53,7 @@ class Consumer extends Base
|
||||||
$lngRange = [];
|
$lngRange = [];
|
||||||
$latRange = [];
|
$latRange = [];
|
||||||
$whereMap = [];
|
$whereMap = [];
|
||||||
$sortOrder = ['square'=> 'asc', 'start_time'=>'asc'];
|
$sortOrder = ['square'=> 'asc', 'id'=>'desc'];
|
||||||
|
|
||||||
$whereMap[] = ['status', '=', CouponMain::status_on];
|
$whereMap[] = ['status', '=', CouponMain::status_on];
|
||||||
$whereMap[] = ['on_shelf', '=', CouponMain::on_shelf_on];
|
$whereMap[] = ['on_shelf', '=', CouponMain::on_shelf_on];
|
||||||
|
|
|
@ -206,6 +206,7 @@ class Agency extends Base
|
||||||
'mobile|手机号' => 'require|unique:member,mobile,' . $id,
|
'mobile|手机号' => 'require|unique:member,mobile,' . $id,
|
||||||
'nickname|昵称' => 'require|chsAlphaNum|min:2|max:10',
|
'nickname|昵称' => 'require|chsAlphaNum|min:2|max:10',
|
||||||
'remark|备注信息' => 'max:255',
|
'remark|备注信息' => 'max:255',
|
||||||
|
'business_code|商家' => 'length:32',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($validate !== true) {
|
if ($validate !== true) {
|
||||||
|
@ -220,24 +221,24 @@ class Agency extends Base
|
||||||
try {
|
try {
|
||||||
//之前关联的商家不为空 并且已经改变 吧之前的商家 从代理商变成普通商家
|
//之前关联的商家不为空 并且已经改变 吧之前的商家 从代理商变成普通商家
|
||||||
if ($info['business_code'] != $item['business_code']) {
|
if ($info['business_code'] != $item['business_code']) {
|
||||||
if($info['business_code']!="_" ){
|
if(!empty($info['business_code'])){
|
||||||
$oldBusiness = BusinessRepository::getInstance()->findOneByWhere(["code" => $info['business_code']]);
|
$oldBusiness = BusinessRepository::getInstance()->findOneByWhere(["code" => $info['business_code']]);
|
||||||
if (!empty($oldBusiness)) {
|
if (!empty($oldBusiness)) {
|
||||||
$oldBusiness->save(["is_agency" => BusinessModel::COMMON_OFF]);
|
$oldBusiness->save(["is_agency" => BusinessModel::COMMON_OFF]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//如果改变了关联商家
|
//如果改变了关联商家
|
||||||
if($item['business_code']!="_"){
|
if(!empty($item['business_code'])){
|
||||||
$Business = BusinessRepository::getInstance()->findOneByWhere(["code" => $item['business_code']]);
|
$business = BusinessRepository::getInstance()->findOneByWhere(["code" => $item['business_code']]);
|
||||||
if (empty($Business)) {
|
if (empty($business)) {
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
return $this->json(4001, "指定商家不存在");
|
return $this->json(4001, "指定商家不存在");
|
||||||
}
|
}
|
||||||
$Business->save(["is_agency" => BusinessModel::COMMON_ON]);
|
$business->save(["is_agency" => BusinessModel::COMMON_ON]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//修改下级工作人员的平台商号
|
//修改下级工作人员的平台商号
|
||||||
BusinessModel::where("pid",$info['id'])->update(["business_code"=>$item['business_code']]);
|
memberModel::where("pid",$info['id'])->update(["business_code"=>$item['business_code']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$info->save($item);
|
$info->save($item);
|
||||||
|
@ -389,13 +390,20 @@ class Agency extends Base
|
||||||
if (empty($ids)) {
|
if (empty($ids)) {
|
||||||
$ids[] = input('post.id/d');
|
$ids[] = input('post.id/d');
|
||||||
}
|
}
|
||||||
foreach ($ids as $id) {
|
|
||||||
if ($id == 1) {
|
|
||||||
|
$member = MemberModel::findList([["id","in",$ids]]);
|
||||||
|
foreach ($member as $item){
|
||||||
|
if ($item->id == 1) {
|
||||||
return $this->json(5000, "错误的删除操作");
|
return $this->json(5000, "错误的删除操作");
|
||||||
}
|
}
|
||||||
if(MemberModel::hasStaff($id)){
|
if(MemberModel::hasStaff($item->id)){
|
||||||
return $this->json(5000, "还存在员工,不能删除");
|
return $this->json(5000, "还存在员工,不能删除");
|
||||||
}
|
}
|
||||||
|
//修改对应的商家成普通商家
|
||||||
|
if(!empty($item->business_code)){
|
||||||
|
BusinessModel::where("code",$item->business_code)->update(["is_agency"=>BusinessModel::COMMON_OFF]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MemberModel::deleteByIds($ids);
|
MemberModel::deleteByIds($ids);
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
|
|
|
@ -81,7 +81,7 @@ class Bill extends Base
|
||||||
public function deduction()
|
public function deduction()
|
||||||
{
|
{
|
||||||
$startTime = input("start_time/s", date("Y-m-d H:i:s", strtotime(date("Y-m-d") . " -1 month")));
|
$startTime = input("start_time/s", date("Y-m-d H:i:s", strtotime(date("Y-m-d") . " -1 month")));
|
||||||
$endTime = input("end_time/s", date("Y-m-d 00:00:00"));
|
$endTime = input("end_time/s", date("Y-m-d 23:59:59"));
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$repo = BillRepository::getInstance();
|
$repo = BillRepository::getInstance();
|
||||||
$keyword = $this->request->param('keyword/s', '');
|
$keyword = $this->request->param('keyword/s', '');
|
||||||
|
|
|
@ -173,15 +173,14 @@ class BillRepository extends Repository
|
||||||
];
|
];
|
||||||
$rep = Deduction::alias("a")
|
$rep = Deduction::alias("a")
|
||||||
->join("business c", "a.business_code = c.code")
|
->join("business c", "a.business_code = c.code")
|
||||||
->join("business f", "f.code = c.agency_code", "left")
|
|
||||||
->join("coupon_main e", "a.coupon_main_id = e.id")
|
->join("coupon_main e", "a.coupon_main_id = e.id")
|
||||||
->join("coupon_bill d", "a.bill_id = d.id")
|
->join("coupon_bill d", "a.bill_id = d.id")
|
||||||
->join("account b", "d.user_code = b.user_code", "left")
|
->join("account b", "a.user_code = b.user_code")
|
||||||
->when(!empty($startTime), function ($q) use ($startTime) {
|
->when(!empty($startTime), function ($q) use ($startTime) {
|
||||||
$q->whereTime("a.create_time", ">=", $startTime);
|
$q->whereTime("a.create_time", ">=", $startTime);
|
||||||
})
|
})
|
||||||
->when(!empty($keyword), function ($q) use ($keyword) {
|
->when(!empty($keyword), function ($q) use ($keyword) {
|
||||||
$q->where("c.business_name|f.business_name", "like", "%" . $keyword . "%");
|
$q->where("c.business_name|e.name", "like", "%" . $keyword . "%");
|
||||||
})
|
})
|
||||||
->when(!empty($endTime), function ($q) use ($endTime) {
|
->when(!empty($endTime), function ($q) use ($endTime) {
|
||||||
$q->whereTime("a.create_time", "<=", $endTime);
|
$q->whereTime("a.create_time", "<=", $endTime);
|
||||||
|
@ -195,7 +194,8 @@ class BillRepository extends Repository
|
||||||
"b.avatar_url",
|
"b.avatar_url",
|
||||||
"e.name as coupon_main_name",
|
"e.name as coupon_main_name",
|
||||||
"c.business_name",
|
"c.business_name",
|
||||||
"f.business_name as agency_business_name",
|
"c.agency_code",
|
||||||
|
|
||||||
|
|
||||||
"d.consumer_money",
|
"d.consumer_money",
|
||||||
"d.admin_money",
|
"d.admin_money",
|
||||||
|
@ -212,6 +212,15 @@ class BillRepository extends Repository
|
||||||
->page($page, $size)
|
->page($page, $size)
|
||||||
->order($orders)
|
->order($orders)
|
||||||
->select();
|
->select();
|
||||||
|
$failData["list"]->each(function ($item){
|
||||||
|
if(empty($item->agency_code)){
|
||||||
|
$item->agency_business_name = MemberModel::whereRaw("FIND_IN_SET('".MemberModel::ANENT_ROLE_ID."',roles)" )
|
||||||
|
->where("business_code",$item->agency_code)->value("nickname","");
|
||||||
|
}else{
|
||||||
|
$item->agency_business_name = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
return $failData;
|
return $failData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ class BusinessRepository extends Repository
|
||||||
$q = $this->model->alias("a")
|
$q = $this->model->alias("a")
|
||||||
->join("account b", "a.code = b.business_code")
|
->join("account b", "a.code = b.business_code")
|
||||||
->join("category c", "a.type = c.id","left")
|
->join("category c", "a.type = c.id","left")
|
||||||
->where("b.type","=",Account::type_business)
|
->where("b.type","=",Account::type_consumer)
|
||||||
->field(["a.code as business_code",
|
->field(["a.code as business_code",
|
||||||
"b.avatar_url",
|
"b.avatar_url",
|
||||||
"b.nick_name as account_nick_name",
|
"b.nick_name as account_nick_name",
|
||||||
|
|
|
@ -8,8 +8,8 @@ class BusinessValidate extends Validate
|
||||||
{
|
{
|
||||||
protected $rule = [
|
protected $rule = [
|
||||||
'type' => 'require|gt:0',
|
'type' => 'require|gt:0',
|
||||||
'business_name|商家名称' => 'require|max:150',
|
'business_name|商家名称' => 'require|graph|max:150',
|
||||||
'business_subtitle|商家简称' => 'require|max:150',
|
'business_subtitle|商家简称' => 'require|graph|max:150',
|
||||||
'business_license|营业执照' => 'require|max:250',
|
'business_license|营业执照' => 'require|max:250',
|
||||||
'contact_name|联系人' => 'require|max:20',
|
'contact_name|联系人' => 'require|max:20',
|
||||||
'contact_phone|联系电话' => 'require|max:20',
|
'contact_phone|联系电话' => 'require|max:20',
|
||||||
|
|
|
@ -15,7 +15,7 @@ class CouponRelease extends Validate
|
||||||
'type|优惠券类型' => 'require',
|
'type|优惠券类型' => 'require',
|
||||||
'start_time|开始时间' => 'require|date',
|
'start_time|开始时间' => 'require|date',
|
||||||
'end_time|结束时间' => 'require|date|checkEndTime',
|
'end_time|结束时间' => 'require|date|checkEndTime',
|
||||||
'name|优惠券名称' => 'require|length:3,32',
|
'name|优惠券名称' => 'require|graph|length:3,32',
|
||||||
'money|金额' => 'require|>:0|<=:5000',
|
'money|金额' => 'require|>:0|<=:5000',
|
||||||
'deduction_money|扣除金额' => 'require|>=:0.1|<=:5000',
|
'deduction_money|扣除金额' => 'require|>=:0.1|<=:5000',
|
||||||
'image_url|预览图' => 'require',
|
'image_url|预览图' => 'require',
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<button class="layui-btn layui-btn-normal" data-url="/manager/agency/edit?id={$item.id}" lay-submit lay-filter="saveMember">确认保存</button>
|
<button class="layui-btn layui-btn-normal" data-url="/manager/agency/edit-channel?id={$item.id}" lay-submit lay-filter="saveMember">确认保存</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue