| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- namespace App\Services\Common;
- use App\Models\MemberModel;
- use App\Services\BaseService;
- /**
- * 会员管理-服务类
- * @author laravel开发员
- * @since 2020/11/11
- * Class MemberService
- * @package App\Services\Common
- */
- class MemberService extends BaseService
- {
- /**
- * 构造函数
- * @author laravel开发员
- * @since 2020/11/11
- * MemberService constructor.
- */
- public function __construct()
- {
- $this->model = new MemberModel();
- }
- /**
- * 添加会编辑会员
- * @return array
- * @since 2020/11/11
- * @author laravel开发员
- */
- public function edit()
- {
- // 请求参数
- $data = request()->all();
- // 头像处理
- $avatar = trim($data['avatar']);
- if (strpos($avatar, "temp")) {
- $data['avatar'] = save_image($avatar, 'member');
- } else {
- $data['avatar'] = str_replace(IMG_URL, "", $data['avatar']);
- }
- // 出生日期
- if ($data['birthday']) {
- $data['birthday'] = strtotime($data['birthday']);
- }
- // 城市处理
- $city = isset($data['city']) ? $data['city'] : [3];
- if (!empty($data['city'])) {
- // 省份
- $data['province_id'] = $city[0];
- // 城市
- $data['city_id'] = $city[1];
- // 县区
- $data['district_id'] = $city[2];
- }
- unset($data['city']);
- return parent::edit($data); // TODO: Change the autogenerated stub
- }
- }
|