www.maiwd.cn // +---------------------------------------------------------------------- /** * Class Business * Desc 商圈管理 * Create on 2024/3/12 14:43 * Create by @小趴菜 */ namespace app\api\model\wdsxh\business; use app\admin\model\wdsxh\points\PointsConfig; use app\api\model\wdsxh\Base; use app\common\model\wdsxh\points\UserWechatPointsLog; use traits\model\SoftDelete; class Business extends Base { use SoftDelete; // 表名 protected $name = 'wdsxh_business'; // 自动写入时间戳字段 protected $autoWriteTimestamp = 'integer'; // 定义时间戳字段名 protected $createTime = 'createtime'; protected $updateTime = 'updatetime'; protected $deleteTime = 'deletetime'; protected static function init() { self::afterInsert(function ($row) { $is_process = (new BusinessConfig())->where('id',1)->value('is_process'); $add_points = (new PointsConfig())->where('id',1)->value('public_business_get_points'); if($is_process==2 && $add_points>0){ UserWechatPointsLog::addPoints(1,'需求发布',$row['wechat_id'],$add_points,3); } }); } }