|
@@ -4,6 +4,7 @@ namespace app\common\model;
|
|
|
|
|
|
use app\admin\model\Admin;
|
|
|
use app\common\service\MobileComputer;
|
|
|
+use app\common\service\MobilePriceLogService;
|
|
|
use think\Cache;
|
|
|
use think\db\Query;
|
|
|
use think\helper\Str;
|
|
@@ -110,6 +111,13 @@ class Mobile extends Model
|
|
|
$mobile['city']=Area::where('id',$mobile['city_id'])->value('shortname');
|
|
|
}
|
|
|
}
|
|
|
+ public function makePriceLog(){
|
|
|
+ (new MobilePriceLogService)
|
|
|
+ ->setMobile($this)
|
|
|
+ ->setBeforePrice($this->origin['amount'])
|
|
|
+ ->setAfterPrice($this['amount'])
|
|
|
+ ->log();
|
|
|
+ }
|
|
|
public function makeRules(){
|
|
|
$mobile=$this;
|
|
|
foreach (MobileComputer::setMobile($mobile['no'])->filter() as $key=>$value){
|
|
@@ -156,6 +164,7 @@ class Mobile extends Model
|
|
|
$mobile->makeAmount();
|
|
|
}
|
|
|
$mobile->makeArea();
|
|
|
+ $mobile->makePriceLog();
|
|
|
});
|
|
|
self::beforeInsert(function (self $mobile){
|
|
|
$mobile['sort']=mt_rand(0,99999999);
|