Commit 14aa8e1e by 庄欣

lvpaichengshi

parent 84ceca4b
......@@ -31,7 +31,6 @@ class SetsEditedListener
}
}
}
}
......
......@@ -42,7 +42,7 @@ class SetsSearcherListener
'sets_id' => $model->id,
'title' => $model->title,
'kw' => $keyworks,
'photographer_name' => UserModel::getUserInfo($model->uid)->nickname,
'photographer_name' => UserModel::getUserInfo($model->uid,['nickname'])->nickname,
'lasttime' => date("Y-m-d H:i:s",time()),
'is_promotion' => $model->is_promotion,
'start_time'=> $model->start_time,
......
......@@ -30,7 +30,11 @@ class Category extends Model
parent::__construct($attributes);
if (isset($attributes['category_id']) && $attributes['category_id'] > 0) {
$id = $attributes['category_id'];
$this->category_name = Cates::where("id",$id)->first()->category_name;
try {
$this->category_name = Cates::where("id", $id)->first()->category_name;
} catch (\Exception $e) {
$this->category_name = " ";
}
}
$this->beforeValidationOnCreate();
}
......
......@@ -15,7 +15,7 @@ class Promotion extends Model
{
use Models;
protected $table = "myp_sets_promotion";
public $timestamps = false;
protected $fillable = [
"promotion_price","promotion_start_time","promotion_end_time",
"per_user_count", "city_id","is_del"
......@@ -31,10 +31,10 @@ class Promotion extends Model
{
$this->is_del = 0;
$this->sort = 0;
$this->p_cost_count = 0;
$this->p_cost = 0;
$this->p_lock = 0;
$this->p_sale = 0;
$this->p_total_sale = 0;
$this->p_order_count = 0;
}
......
......@@ -94,7 +94,7 @@ class Sets extends Model
$data['temp_price'] = $data['price'];
$model->fill($data)->save();
//促销
if (isset($data['promotion'])) {
if (isset($data['promotion']) && $data['is_promotion'] == 1) {
$models = Promotion::add($data['promotion']);
$model->relation_promotion()->saveMany($models);
};
......@@ -134,11 +134,14 @@ class Sets extends Model
$data['temp_price'] = $data['price'];
$this->update($data);
//促销
if (isset($data['promotion']) && !empty($data['promotion'])) {
if (isset($data['promotion']) && !empty($data['promotion']) && $data['is_promotion'] == 1) {
$models = Promotion::add($data['promotion']);
$this->relation_promotion()->update(['is_del' => 1]);
$this->relation_promotion()->saveMany($models);
};
} elseif ($data['is_promotion'] == 0) {
$this->relation_promotion()->update(['is_del' => 1]);
$this->update(['promotion_id' => 0]);
}
//绑定的样片
if (isset($data['works']) && !empty($data['works'])) {
$models = Works::add($data['works']);
......
......@@ -35,8 +35,6 @@ class SetsValidator extends Validator
'is_shelf' => 'required|in:0,1',
'change_descr' => 'required',
'other_descr' => 'required',
'travel_city_id' => 'required',
'travel_city_name' => 'required',
'abroad' => 'required|in:0,1',
'modeling_count_from_user' => 'required|min:0',
'is_promotion' => "required|in:0,1"
......@@ -81,9 +79,7 @@ class SetsValidator extends Validator
'change_descr.required' => '改期说明必填',
'other_descr.required' => '其它说明必填',
'service_city_id.required' => '所属城市ID必填',
'travel_city_id.required' => '旅拍城市ID必填',
'service_city_name.required' => '所属城市名称必填',
'travel_city_name.required' => '旅拍城市名称必填',
'modeling_count_from_user.required' => '允许用户自带必填',
'negative_give_all.required' => '摄影师提供数必填',
'is_shelf.required' => '上下架状态必填',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment