getMessage(), 500); } } /** * Notes:修改活动 * @param string $goods_name * @param int $goods_id * @return int * User: YCP * Date: 2023/2/23 */ public static function updateActivity(array $params, int $admin_id) { Activity::affairBegin(); try { $where = []; $where['config_id'] = $params['config_id']; $info = Activity::where($where)->first(); if(empty($info) || $info === false) { throw new \Exception('活动信息不存在'); } $params['config_update_time'] = time(); $result = Activity::where($where)->update($params); if ($result !== false){ $msg = '管理员:' . $admin_id . '在:' . date("Y-m-d H:i:s", time()) . '修改营销活动-编号: ' . $params['config_id']; plog('life-activity-update', '修改营销活动', $msg); Activity::affairCommit(); return true; } throw new \Exception('操作失败!'); }catch (\Exception $exception){ Activity::affairRollback(); throw new \Exception($exception->getMessage(), 500); } } /** * Notes:删除活动 * @param int $goods_id * @return int * User: YCP * Date: 2023/2/23 */ public static function delActivity($config_id,$admin_id) { Activity::affairBegin(); try { $where = []; $where['config_id'] = $config_id; $data['config_is_del'] = 1; $result = Activity::where($where)->update($data); if (!empty($result)){ $msg = '管理员:' . $admin_id . '在:' . date("Y-m-d H:i:s", time()) . '删除营销活动-编号: ' . $config_id; plog('life-activity-delete', '删除营销活动', $msg); Activity::affairCommit(); return true; }else{ return false; } }catch (\Exception $exception){ Activity::affairRollback(); throw new \Exception($exception->getMessage(), 500); } } /** * Notes:查询活动 * @param int $goods_id * @return int * User: YCP * Date: 2022/10/18 */ public static function activityInfo($config_id) { $where = []; $where['config_id'] = $config_id; $result = Activity::where($where)->first(); if(empty($result) || $result === false) { throw new \Exception('活动信息不存在'); } $result['activity_url'] = "https://service.wanyuewellness.cn/h5/#/?act=".$config_id; return $result; } }