123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824 |
- <?php
- namespace app\data\controller\api\auth;
- use app\admin\controller\Merchant;
- use app\data\controller\api\Auth;
- use app\data\controller\api\Data;
- use app\data\model\BaseUserMessage;
- use app\data\model\BaseUserMessageRead;
- use app\data\model\BaseUserPayment;
- use app\data\model\BaseUserUpgrade;
- use app\data\model\DataBestKnowledge;
- use app\data\model\DataCollectionLog;
- use app\data\model\DataFeedback;
- use app\data\model\DataMaintenance;
- use app\data\model\DataMerchants;
- use app\data\model\DataPoolTalent;
- use app\data\model\DataPoolTalentChild;
- use app\data\model\DataShipyard;
- use app\data\model\DataTeachingKnowledge;
- use app\data\model\DataUser;
- use app\data\model\DataUserAcceptance;
- use app\data\model\DataUserApplyJobInfo;
- use app\data\model\DataUserApplyJobInfoChild;
- use app\data\model\DataUserBankCard;
- use app\data\model\DataUserLeaveMessage;
- use app\data\model\DataUserMoneyLog;
- use app\data\model\DataUserPurchaseAcceptance;
- use app\data\model\DataUserRepair;
- use app\data\model\DataUserRepairOffer;
- use app\data\model\DataUserVipOrder;
- use app\data\model\DataUserWithdraw;
- use app\data\model\DataZhicheng;
- use app\data\model\ShopCoordination;
- use app\data\model\ShopFavourite;
- use app\data\model\ShopOcean;
- use app\data\model\ShopOrder;
- use app\data\model\ShopProduction;
- use app\data\model\ShopPurchase;
- use app\data\service\MessageService;
- use app\data\service\payment\WechatPaymentService;
- use app\data\service\PaymentService;
- use app\data\service\UserAdminService;
- use app\data\service\UserUpgradeService;
- use JPush\AdminClient;
- use PhpOffice\PhpWord\PhpWord;
- use PhpOffice\PhpWord\TemplateProcessor;
- use think\admin\Storage;
- use think\db\Query;
- use think\exception\HttpResponseException;
- use think\admin\Controller;
- use hg\apidoc\annotation\Title;
- use hg\apidoc\annotation\Method;
- use hg\apidoc\annotation\Param;
- use hg\apidoc\annotation\Header;
- use hg\apidoc\annotation\Returned;
- use think\facade\Db;
- use think\facade\Validate;
- use WePay\Order;
- use JPush\Client as jpush;
- /**
- * @Title("个人中心")
- */
- class Center extends Auth
- {
- protected $noNeedLogin=['upload','image','uploadmore','messagelist','getandroidversion','zclist'];
- /**
- * @Title("获取用户资料")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Returned("token.token",desc="token")
- * @Returned("pooltalent",desc="提交的人才库信息,为空则未提交")
- * @Returned("pooltalent.audit",desc="人才库审核状态1:待审核 2:审核通过 3:审核不通过")
- * @Returned("pooltalent.why",desc="人才库审核不通过原因")
- * @Returned("maintenance",desc="提交的维修工申请,为空则未提交")
- * @Returned("maintenance.audit",desc="维修工申请审核状态1:待审核 2:审核通过 3:审核不通过")
- * @Returned("maintenance.why",desc="维修工申请审核不通过原因")
- * @Returned("shipyard",desc="提交的入驻船厂申请,为空则未提交")
- * @Returned("shipyard.audit",desc="入驻船厂申请审核状态1:待审核 2:审核通过 3:审核不通过")
- * @Returned("shipyard.why",desc="入驻船厂申请审核不通过原因")
- * @Returned("merchants",desc="提交的入驻商家申请,为空则未提交")
- * @Returned("merchants.audit",desc="入驻商家申请审核状态1:待审核 2:审核通过 3:审核不通过")
- * @Returned("merchants.why",desc="入驻商家申请审核不通过原因")
- * @Returned("collection_count",desc="收藏数量")
- */
- public function get()
- {
- $user = $this->getUser();
- $count = DataCollectionLog::mk()->where('uuid',$this->uuid)->where('cate',1)->whereNotIn('type',[3,4])->count();
- $count2 = ShopFavourite::mk()->where('user_id',$this->uuid)->count();
- $user['collection_count'] = bcadd($count,$count2);
- $this->success('获取用户资料', $user);
- }
- /**
- * @Title("平台规则")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- *
- * @Returned("platform_rules",desc="平台规则")
- */
- public function getplatformrules(){
- $info= [
- 'platform_rules'=>htmlspecialchars_decode(sysconf('platform.platform_rules')),
- ];
- $this->success('成功',$info);
- }
- /**
- * @Title("Base64图片上传")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=0,default="",desc="token")
- * @Returned("url",desc="图片地址")
- */
- public function image()
- {
- try {
- $data = $this->_vali(['base64.require' => '图片内容不为空!']);
- if (preg_match($preg = '|^data:image/(.*?);base64,|i', $data['base64'])) {
- [$ext, $img] = explode('|||', preg_replace($preg, '$1|||', $data['base64']));
- if (empty($ext) || !in_array(strtolower($ext), ['png', 'jpg', 'jpeg'])) {
- $this->error('图片格式异常!');
- }
- $name = Storage::name($img, $ext, 'image/');
- $info = Storage::instance()->set($name, base64_decode($img));
- $this->success('图片上传成功!', ['url' => $info['url']]);
- } else {
- $this->error('解析内容失败!');
- }
- } catch (HttpResponseException $exception) {
- throw $exception;
- } catch (\Exception $exception) {
- trace_file($exception);
- $this->error($exception->getMessage());
- }
- }
- /**
- * @Title("二进制图片、文件上传")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=0,default="",desc="token")
- * @Param("file",type="file",require=1,default="",desc="文件")
- * @Returned("url",desc="图片地址")
- */
- public function upload()
- {
- ini_set ("memory_limit","-1");
- $file = $this->request->file('file');
- if (empty($file)) $this->error('文件上传异常!');
- $extension = strtolower($file->getOriginalExtension());
- if (in_array($extension, ['php', 'sh'])) $this->error('禁止上传此类文件!');
- $bina = file_get_contents($file->getRealPath());
- $name = Storage::name($file->getPathname(), $extension, '', 'md5_file');
- $info = Storage::instance()->set($name, $bina, false, $file->getOriginalName());
- if (is_array($info) && isset($info['url'])) {
- $this->success('文件上传成功!', $info);
- } else {
- $this->error('文件上传失败!');
- }
- }
- /**
- * @Title("二进制图片、文件上传多个")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=0,default="",desc="token")
- * @Param("file[]",type="file",require=1,default="",desc="文件")
- * @Returned("url",desc="图片地址")
- */
- public function uploadmore()
- {
- ini_set ("memory_limit","-1");
- $file = $this->request->file('file');
- if (empty($file)) $this->error('文件上传异常!');
- $array = [];
- foreach ($file as $file){
- $extension = strtolower($file->getOriginalExtension());
- if (in_array($extension, ['php', 'sh'])) $this->error('禁止上传此类文件!');
- $bina = file_get_contents($file->getRealPath());
- $name = Storage::name($file->getPathname(), $extension, '', 'md5_file');
- $info = Storage::instance()->set($name, $bina, false, $file->getOriginalName());
- array_push($array,$info);
- }
- $this->success('文件上传成功!', $array);
- }
- /**
- * @Title("更新用户资料")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("headimg",type="string",require=0,default="",desc="头像")
- * @Param("nickname",type="string",require=0,default="",desc="昵称")
- * @Param("email",type="string",require=0,default="",desc="邮箱")
- * @Param("base_sex",type="string",require=0,default="",desc="性别")
- */
- public function set()
- {
- $data = $this->_vali([
- 'headimg.default' => '',
- 'nickname.default' => '',
- 'email.default' => '',
- 'base_sex.default' => '',
- ]);
- foreach ($data as $key => $vo) if ($vo === '') unset($data[$key]);
- if (empty($data)) $this->error('没有修改的数据!');
- if (DataUser::mk()->where(['id' => $this->uuid])->update($data) !== false) {
- $this->success('更新资料成功!', $this->getUser());
- } else {
- $this->error('更新资料失败!');
- }
- }
- /**
- * @Title("修改密码")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("password",type="string",require=0,default="",desc="原密码")
- * @Param("newpassword",type="string",require=0,default="",desc="新密码")
- */
- public function uppass()
- {
- $data = $this->_vali([
- 'password.require'=>'原密码必须',
- 'newpassword.require'=>'新密码必须'
- ]);
- if ($data['password']==$data['newpassword']) $this->error('原密码与新密码一样');
- $pass = DataUser::mk()->where('id',$this->uuid)->value('password');
- if (md5($data['password'])!=$pass) $this->error('原密码验证错误');
- if (DataUser::mk()->where(['id' => $this->uuid])->update(['password'=>md5($data['newpassword'])]) !== false) {
- $this->success('更新密码成功!', $this->getUser());
- } else {
- $this->error('更新密码失败!');
- }
- }
- /**
- * @Title("获取开通vip配置信息")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- *
- * @Returned("price",desc="价格")
- * @Returned("user_vip_des",desc="会员权益说明")
- * @Returned("user_vip_agreement",desc="会员服务协议")
- */
- public function getvipinfo(){
- $info= [
- 'price'=>sysconf('user_vip.price'),
- 'user_vip_des'=>htmlspecialchars_decode(sysconf('user_vip.user_vip_des')),
- 'user_vip_agreement'=>htmlspecialchars_decode(sysconf('user_vip.user_vip_agreement')),
- ];
- $this->success('成功',$info);
- }
- /**
- * @Title("获取支付方式")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- *
- * @Param("type",type="string",require=1,default="",desc="1:开通会员vip 2:商城、充值")
- * @Param("from",type="string",require=1,default="",desc="1:微信小程序 2:APP")
- */
- public function channel()
- {
- $data = $this->_vali([
- 'type.require|in:1,2'=>'type有误',
- 'from.require|in:1,2'=>'来源有误'
- ]);
- $type = $data['type'];
- $from = $data['from'];
- // 读取支付通道配置
- $query = BaseUserPayment::mk()->where(['status' => 1, 'deleted' => 0])
- ->when($type,function ($query) use ($type){
- if ($type==2){
- $query->where('type','<>','balance');
- }
- })->where(function ($query) use ($from){
- if ($from==1){
- $query->whereNotIn('type',['wechat_app','alipay_app']);
- }else{
- $query->where('type','<>','wechat_xcx');
- }
- });
- //$query->whereIn('code', str2arr($payments))->whereIn('type', PaymentService::getTypeApi($this->type));
- $result = $query->order('sort desc,id desc')->column('type,code,name,cover,content,remark', 'code');
- foreach ($result as &$vo) $vo['content'] = ['voucher_qrcode' => json_decode($vo['content'])->voucher_qrcode ?? ''];
- $this->success('获取支付参数数据', array_values($result));
- }
- /**
- * @Title("开通会员")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("pay_code",type="string",require=1,default="",desc="支付方式code")
- * @Param("difference_pay_code",type="string",require=0,default="",desc="余额支付时,差价支付方式code")
- *
- */
- public function openvip(){
- $user = $this->getUser();
- $data = $this->_vali([
- 'pay_code.require'=>'支付code有误',
- 'difference_pay_code.default'=>''
- ]);
- $code = $data['pay_code'];
- $difference_pay_code = $data['difference_pay_code'];
- $pay_type = BaseUserPayment::mk()->where(['status' => 1, 'deleted' => 0,'code'=>$code])->value('type') ? : $this->error('支付找不到');
- $all_price = sysconf('user_vip.price');
- $order_no = setorderno($this->uuid);
- $insert = [
- 'uuid'=>$this->uuid,
- 'order_no'=>$order_no,
- 'all_price'=>$all_price,
- 'pay_type'=>$pay_type
- ];
- $error = 1;
- Db::startTrans();
- $retrun_data = [];
- try {
- if ($pay_type=='balance'){
- if ($user['money']<$all_price){
- if (empty($difference_pay_code) || !isset($difference_pay_code)){
- $error = 0;
- $errorinfo = '余额不足';
- }else{
- $difference_pay_type = BaseUserPayment::mk()->where(['status' => 1, 'deleted' => 0,'code'=>$difference_pay_code])->value('type');
- if (!$difference_pay_type){
- $error = 0;
- $errorinfo = '差价支付找不到';
- }else{
- $all_price = bcsub($all_price,$user['money'],2);
- $insert['yue_price'] = $user['money'];
- $insert['difference_money'] = $all_price;
- $insert['difference_pay_type'] = $difference_pay_type;
- $code = $difference_pay_code;
- $pay_type = $difference_pay_type;
- }
- }
- }
- }
- if ($error){
- $order_id = DataUserVipOrder::mk()->insertGetId($insert);
- if (stripos($pay_type, 'alipay_') === 0) {
- $notify_name = 'opvipzfb';
- } elseif (stripos($pay_type, 'wechat_') === 0) {
- $notify_name = 'opvipwx';
- } else{
- $notify_name = 'opvip';
- }
- $notify_url = sysuri("@data/api.notify/{$notify_name}/scene/order/param/{$code}", [], false, true);
- $parm = ['uuid'=>$this->uuid,'order_id'=>$order_id];
- $pay =PaymentService::instance($code)->create($user['openid1'],$order_no,$all_price,'开通vip','开通vip','','',$notify_url,$parm);
- $retrun_data['order_no'] = $order_no;
- $pay['packages'] = isset($pay['package']) ? $pay['package'] : '';
- $retrun_data['pay'] = $pay;
- $retrun_data['success'] = isset($pay['result']) && $pay['result']=='success' ? 1 : 0;
- Db::commit();
- }
- } catch (\Exception $e) {
- dump($e);
- // 回滚事务
- Db::rollback();
- $error = 0;
- $errorinfo = '未知错误';
- }
- if ($error){
- $this->success('成功',$retrun_data);
- }
- $this->error($errorinfo);
- }
- /**
- * @Title("人才库职称列表")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- */
- public function zclist()
- {
- $list = DataZhicheng::Show()->select();
- $this->success('成功',$list);
- }
- /**
- * @Title("加入人才库/编辑人才库")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("name",type="string",require=1,default="",desc="姓名")
- * @Param("sex",type="string",require=1,default="",desc="性别")
- * @Param("age",type="string",require=1,default="",desc="年龄")
- * @Param("jg",type="string",require=1,default="",desc="籍贯")
- * @Param("phone",type="string",require=1,default="",desc="手机号")
- * @Param("email",type="string",require=1,default="",desc="邮箱")
- * @Param("province",type="string",require=1,default="",desc="省")
- * @Param("city",type="string",require=1,default="",desc="市")
- * @Param("area",type="string",require=1,default="",desc="区/镇")
- * @Param("address",type="string",require=1,default="",desc="详细地址")
- * @Param("graduate_school",type="string",require=1,default="",desc="毕业院校")
- * @Param("xl",type="string",require=1,default="",desc="学历")
- * @Param("major",type="string",require=1,default="",desc="专业")
- * @Param("working_life",type="string",require=1,default="",desc="工作年限")
- * @Param("tc",type="string",require=1,default="",desc="特长")
- * @Param("jn",type="string",require=1,default="",desc="技能")
- * @Param("zc_id",type="string",require=1,default="",desc="职称ID")
- * @Param("zz_imgs",type="string",require=1,default="",desc="资质证书,多个以逗号隔开")
- * @Param("pxjl",type="string",require=1,default="",desc="培训经历")
- * @Param("id",type="string",require=0,default="",desc="审核失败,修改,则必传之前提交的ID")
- */
- public function adduppooltalent()
- {
- $data = $this->_vali([
- 'uuid.default'=>$this->uuid,
- 'name.require'=>'姓名必须',
- 'sex.require'=>'性别必须',
- 'age.require|number|between:1,120'=>'年龄必须,1-120',
- 'jg.require'=>'籍贯必须',
- 'phone.require'=>'手机号必须',
- 'email.require'=>'邮箱必须',
- 'province.require'=>'省必须',
- 'city.require'=>'市必须',
- 'area.require'=>'区/镇必须',
- 'address.require'=>'详细地址必须',
- 'graduate_school.require'=>'毕业院校必须',
- 'xl.require'=>'学历必须',
- 'working_life.require'=>'工作年限必须',
- 'major.require'=>'专业必须',
- // 'tc.require'=>'特长必须',
- // 'jn.require'=>'技能必须',
- // 'zc_id.require|number'=>'职称必须',
- 'zz_imgs.require'=>'资质证书必须',
- // 'pxjl.require'=>'培训经历必须',
- ],'post');
- $id = input('id');
- $data['tc'] = input('tc');
- $data['jn'] = input('jn');
- $data['pxjl'] = input('pxjl');
- if (!Validate::regex($data['phone'], "^1\d{10}$")) {
- $this->error('手机号格式错误');
- }
- if(input('zc_id')){
- DataZhicheng::mk()->where('id',input('zc_id'))->where('is_del',1)->count() ? : $this->error('职称不存在');
- }
- empty($id) ? $id = DataPoolTalent::mk()->where('uuid',$this->uuid)->value('id') : $data['update_at']=date('Y-m-d H:i:s');
- DataPoolTalent::mk()->where('uuid',$this->uuid)->value('audit') == 3 ? $data['audit'] =1 : '';
- if (empty($id) ? DataPoolTalent::mk()->insert($data) : DataPoolTalent::mk()->where('id',$id)->update($data)){
- $this->success('提交成功');
- }
- $this->error('提交失败,请稍后重试');
- }
- /**
- * @Title("添加人才库工作经历/编辑人才库工作经历")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("id",type="string",require=1,default="",desc="工作经历ID,编辑时穿")
- * @Param("content",type="json",require=0,default="",desc="工作经历json,(company_name:公司名称,position_name:职位名称,on_job_start:在职时间开始,on_job_end:在职时间结束,job_description:工作内容)")
- */
- public function adduppooltalentchild()
- {
- $data = $this->_vali([
- 'id.default'=>'',
- 'content.require'=>'工作经历必须',
- ]);
- $info_id = DataPoolTalent::mk()->where('uuid',$this->uuid)->value('id') ? : DataPoolTalent::mk()->insertGetId(['uuid'=>$this->uuid]);
- $child_id = $data['id'];
- $child_array = [
- 'info_id'=>$info_id,
- 'content'=>$data['content']
- ];
- //{"company_name":"你","job_description":"哈哈","on_job_end":"2021-12","on_job_start":"2023-12","position_name":"客服"}
- $content = json_decode($data['content']);
- if($content->on_job_start > $content->on_job_end){
- $this->error('离职时间必须在入职时间之后');
- }
- // return $content->on_job_end;
- !empty($child_id) ? $child_array['update_at'] = date('Y-m-d H:i:s') : '';
- if (!empty($child_id) ? DataPoolTalentChild::mk()->where('id',$child_id)->update($child_array) : DataPoolTalentChild::mk()->insert($child_array)){
- $this->success('成功');
- }
- $this->error('失败');
- }
- /**
- * @Title("人才库工作经历删除")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("id",type="string",require=1,default="",desc="ID")
- */
- public function delpooltalentchild(){
- $data = $this->_vali([
- 'id.require'=>'id必须',
- ]);
- if (DataPoolTalentChild::mk()->where('id',$data['id'])->delete()){
- $this->success('成功');
- }
- $this->error('失败');
- }
- /**
- * @Title("申请维修工/编辑维修工")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("name",type="string",require=1,default="",desc="姓名")
- * @Param("id_card",type="string",require=1,default="",desc="身份证号")
- * @Param("email",type="string",require=1,default="",desc="邮箱")
- * @Param("province",type="string",require=1,default="",desc="省")
- * @Param("city",type="string",require=1,default="",desc="市")
- * @Param("area",type="string",require=1,default="",desc="区/镇")
- * @Param("address",type="string",require=1,default="",desc="详细地址")
- * @Param("id_card_img1",type="string",require=1,default="",desc="身份证人面照片")
- * @Param("id_card_img2",type="string",require=1,default="",desc="身份证国徽面照片")
- * @Param("business_img",type="string",require=1,default="",desc="营业执照图片")
- * @Param("authorization_img",type="string",require=0,default="",desc="厂家授权图片")
- * @Param("results",type="string",require=1,default="",desc="以往业绩")
- * @Param("id",type="string",require=0,default="",desc="审核失败,修改,则必传之前提交的ID")
- */
- public function addupmaintenance()
- {
- $data = $this->_vali([
- 'uuid.default'=>$this->uuid,
- 'name.require'=>'姓名必须',
- 'id_card.require'=>'身份证号必须',
- 'email.require'=>'邮箱必须',
- // 'province.require'=>'省必须',
- // 'city.require'=>'市必须',
- // 'area.require'=>'区/镇必须',
- 'address.require'=>'详细地址必须',
- 'id_card_img1.require'=>'身份证人面照片必须',
- 'id_card_img2.require'=>'身份证国徽面照片必须',
- 'business_img.require'=>'营业执照图片必须',
- 'authorization_img.default'=>'',
- 'results.default'=>'',
- ]);
- $data['province'] = input('province');
- $data['city'] = input('city');
- $data['area'] = input('area');
- if (!check_idcard($data['id_card'])) $this->error('身份证号格式错误');
- $id = input('id');
- !empty($id) ? : (DataMaintenance::mk()->where('uuid',$this->uuid)->count() ? $this->error('已经提交过') : '' );
- empty($id) ? : $data['update_at']=date('Y-m-d H:i:s');
- DataMaintenance::mk()->where('uuid',$this->uuid)->value('audit') == 3 ? $data['audit'] =1 : '';
- if (empty($id) ? DataMaintenance::mk()->insert($data) : DataMaintenance::mk()->where('id',$id)->update($data)){
- $this->success('提交成功');
- }
- $this->error('提交失败,请稍后重试');
- }
- /**
- * @Title("申请船厂/编辑船厂")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("name",type="string",require=1,default="",desc="船厂名称")
- * @Param("head_img",type="string",require=1,default="",desc="船厂头像")
- * @Param("province",type="string",require=1,default="",desc="省")
- * @Param("city",type="string",require=1,default="",desc="市")
- * @Param("area",type="string",require=1,default="",desc="区/镇")
- * @Param("address",type="string",require=1,default="",desc="详细地址")
- * @Param("contact_name",type="string",require=1,default="",desc="联系人")
- * @Param("contact_phone",type="string",require=1,default="",desc="联系电话")
- * @Param("intro",type="string",require=1,default="",desc="船厂简介")
- * @Param("longitude",type="string",require=1,default="",desc="经度")
- * @Param("latitude",type="string",require=1,default="",desc="维度")
- * @Param("environment_imgs",type="string",require=1,default="",desc="船厂环境,多个以英文逗号隔开")
- * @Param("product_intro",type="string",require=1,default="",desc="产品简介")
- * @Param("business_img",type="string",require=1,default="",desc="营业执照")
- * @Param("num_staff",type="string",require=1,default="",desc="员工人数")
- * @Param("id",type="string",require=0,default="",desc="审核失败,修改,则必传之前提交的ID")
- */
- public function addupshipyard()
- {
- $data = $this->_vali([
- 'uuid.default'=>$this->uuid,
- 'name.require'=>'船厂名称必须',
- 'longitude.require'=>'经纬度必须',
- 'longitude.float'=>'经纬度有误',
- 'latitude.require'=>'经纬度必须',
- 'latitude.float'=>'经纬度有误',
- 'head_img.require'=>'船厂头像必须',
- 'province.require'=>'省必须',
- 'city.require'=>'市必须',
- 'area.require'=>'区/镇必须',
- 'address.require'=>'详细地址必须',
- 'contact_name.require'=>'联系人必须',
- 'contact_phone.require'=>'联系电话必须',
- 'intro.require'=>'船厂简介必须',
- 'environment_imgs.require'=>'船厂环境必须',
- 'product_intro.require'=>'产品简介必须',
- 'business_img.require'=>'营业执照必须',
- 'num_staff.require'=>'人数必须',
- ]);
- $id = input('id');
- !empty($id) ? : (DataShipyard::mk()->where('uuid',$this->uuid)->count() ? $this->error('已经提交过') : '' );
- empty($id) ? : $data['update_at']=date('Y-m-d H:i:s');
- DataShipyard::mk()->where('uuid',$this->uuid)->value('audit') == 3 ? $data['audit'] =1 : '';
- if (empty($id) ? DataShipyard::mk()->insert($data) : DataShipyard::mk()->where('id',$id)->update($data)){
- $this->success('提交成功');
- }
- $this->error('提交失败,请稍后重试');
- }
- /**
- * @Title("申请商家/编辑商家")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("name",type="string",require=1,default="",desc="商家名称")
- * @Param("head_img",type="string",require=1,default="",desc="商家头像")
- * @Param("province",type="string",require=1,default="",desc="省")
- * @Param("city",type="string",require=1,default="",desc="市")
- * @Param("area",type="string",require=1,default="",desc="区/镇")
- * @Param("address",type="string",require=1,default="",desc="详细地址")
- * @Param("longitude",type="string",require=1,default="",desc="经度")
- * @Param("latitude",type="string",require=1,default="",desc="纬度")
- * @Param("address",type="string",require=1,default="",desc="详细地址")
- * @Param("contact_name",type="string",require=1,default="",desc="联系人")
- * @Param("contact_phone",type="string",require=1,default="",desc="联系电话")
- * @Param("intro",type="string",require=1,default="",desc="商家简介")
- * @Param("imgs_videos",type="string",require=1,default="",desc="图片及视频,以英文逗号隔开")
- * @Param("business_img",type="string",require=1,default="",desc="营业执照")
- * @Param("id",type="string",require=0,default="",desc="审核失败,修改,则必传之前提交的ID")
- */
- public function addupmerchants()
- {
- $data = $this->_vali([
- 'uuid.default'=>$this->uuid,
- 'name.require'=>'商家名称必须',
- 'head_img.require'=>'商家头像必须',
- 'province.require'=>'省必须',
- 'city.require'=>'市必须',
- 'area.require'=>'区/镇必须',
- 'address.require'=>'详细地址必须',
- 'longitude.require'=>'经纬度必须',
- 'latitude.require'=>'经纬度必须',
- 'contact_name.require'=>'联系人必须',
- 'contact_phone.require'=>'联系电话必须',
- 'intro.require'=>'商家简介必须',
- 'imgs_videos.require'=>'图片及视频必须',
- 'business_img.require'=>'营业执照必须',
- ]);
- $id = input('id');
- !empty($id) ? : (DataMerchants::mk()->where('uuid',$this->uuid)->count() ? $this->error('已经提交过') : '' );
- empty($id) ? : $data['update_at']=date('Y-m-d H:i:s');
- DataMerchants::mk()->where('uuid',$this->uuid)->value('audit') == 3 ? $data['audit'] =1 : '';
- if (empty($id) ? DataMerchants::mk()->insert($data) : DataMerchants::mk()->where('id',$id)->update($data)){
- $this->success('提交成功');
- }
- $this->error('提交失败,请稍后重试');
- }
- /**
- * @Title("阿里云金融级实名认证初始化")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("username",type="string",require=1,default="",desc="真实姓名")
- * @Param("id_card",type="string",require=1,default="",desc="身份证号")
- * @Param("MetaInfo",type="string",require=1,default="",desc="metainfo")
- * @Param("ReturnUrl",type="string",require=1,default="",desc="返回地址")
- */
- public function initFaceVerify(){
- $user = $this->getUser();
- //if ($user['is_auth']) $this->error('已实名认证');
- $data = $this->_vali([
- 'username.require'=>'真实姓名必须',
- 'id_card.require'=>'身份证号必须',
- 'MetaInfo.require'=>'metainfo必须',
- 'ReturnUrl.default'=>'2222'
- ]);
- if (!isCreditNo($data['id_card'])) $this->error('身份证号格式错误');
- DataUser::mk()->where('id_card',$data['id_card'])->count() ? $this->error('身份证号已认证过') : '';
- $res = main($data['username'],$data['id_card'],$data['MetaInfo'],$data['ReturnUrl']);
- if(!$res) $this->error('初始化错误');
- $result = json_decode(json_encode($res),true)['body'];
- $result['code'] != 200 ? $this->error($result['message']):$this->success('获取成功',$result);
- }
- /**
- * @Title("实名认证")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("username",type="string",require=1,default="",desc="真实姓名")
- * @Param("id_card",type="string",require=1,default="",desc="身份证号")
- * @Param("CertifyId",type="string",require=1,default="",desc="CertifyId")
- */
- public function userCertification()
- {
- $user = $this->getUser();
- if ($user['is_auth']) $this->error('已实名认证');
- $data = $this->_vali([
- 'username.require'=>'真实姓名必须',
- 'id_card.require'=>'身份证号必须',
- 'is_auth.default'=>1,
- 'CertifyId.require'=>'CertifyId必须'
- ]);
- if (!isCreditNo($data['id_card'])) $this->error('身份证号格式错误');
- DataUser::mk()->where('id_card',$data['id_card'])->count() ? $this->error('身份证号已认证过') : '';
- $data['real_name']=$data['username'];
- unset($data['username']);
- // 核验
- $res = check($data['CertifyId']);
- if(!$res) $this->error('认证失败');
- $result = json_decode(json_encode($res),true)['body'];
- if($result['code'] != 200) $this->error($result['message']);
- unset($data['CertifyId']);
- if (DataUser::mk()->where(['id' => $this->uuid])->update($data) !== false) {
- $this->success('实名认证成功!');
- } else {
- $this->error('实名认证失败!');
- }
- }
- /**
- * @Title("钱包-我的余额")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- */
- public function moneylog(){
- $user = $this->getUser();
- $list = DataUserMoneyLog::Show($this->uuid)->paginate();
- $money = $user['money'];
- $bank_count = DataUserBankCard::Show($this->uuid)->count();
- $this->success('成功',compact('money','bank_count','list'));
- }
- /**
- * @Title("钱包-我的银行卡列表")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- */
- public function mybanklist(){
- $list = DataUserBankCard::Show($this->uuid)->select();
- $this->success('成功',$list);
- }
- /**
- * @Title("绑定银行卡")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("name",type="string",require=1,default="",desc="姓名")
- * @Param("id_card",type="string",require=1,default="",desc="银行卡号")
- * @Param("id",type="string",require=0,default="",desc="修改,则必传之前提交的ID")
- */
- public function bind_bank(){
- $data = $this->_vali([
- 'uuid'=>$this->uuid,
- 'name.require'=>'姓名必须',
- 'id_card.require'=>'卡号必须',
- ]);
- !checkbank($data['id_card']) ? $this->error('卡号不正确') : '';
- $bank_name = bankInfo($data['id_card']);
- empty($bank_name) ? $this->error('卡号不正确或未录入') : '';
- $data['card_name'] = $bank_name;
- $id = input('id');
- DataUserBankCard::Show($this->uuid,$data['id_card'],$id)->count() ? $this->error('卡号已存在') : '';
- empty($id) ? : $data['update_at']=date('Y-m-d H:i:s');
- if (empty($id) ? DataUserBankCard::mk()->insert($data) : DataUserBankCard::mk()->where('id',$id)->update($data)){
- $this->success('提交成功');
- }
- $this->error('提交失败,请稍后重试');
- }
- /**
- * @Title("删除银行卡")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("id",type="string",require=0,default="",desc="修改,则必传之前提交的ID")
- */
- public function delbank(){
- $data = $this->_vali([
- 'id.require'=>'id必须',
- ]);
- if (DataUserBankCard::mk()->where('id',$data['id'])->update(['is_del'=>0,'update_at'=>date('Y-m-d H:i:s')])){
- $this->success('删除成功');
- }
- $this->error('删除失败,请稍后重试');
- }
- /**
- * @Title("获取提现信息")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- *
- * @Returned("withdraw_min_price",desc="最低提现金额")
- * @Returned("withdraw_max_price",desc="最大提现金额")
- * @Returned("poundage_proportion",desc="手续费百分比")
- * @Returned("money",desc="用户可提现余额")
- */
- public function getwithinfo(){
- $user = $this->getUser();
- $info= [
- 'withdraw_min_price'=>sysconf('user.withdraw_min_price'),
- 'withdraw_max_price'=>sysconf('user.withdraw_max_price'),
- 'poundage_proportion'=>sysconf('user.poundage_proportion'),
- 'money'=>$user['money']
- ];
- $this->success('成功',$info);
- }
- /**
- * @Title("提现")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("money",type="string",require=1,default="",desc="提现金额")
- * @Param("bind_id",type="string",require=0,default="",desc="绑定的银行卡记录ID")
- */
- public function withdraw(){
- $user=$this->getUser();
- $data = $this->_vali([
- 'money.require'=>'金额必须',
- 'bind_id.require'=>'绑定的记录ID必须',
- ]);
- $money = $data['money'];
- isAmount($money) ? : $this->error('金额错误');
- $user['money']<$money ? $this->error('余额不足') : '';
- $bank = DataUserBankCard::mk()->where('id',$data['bind_id'])->where('uuid',$this->uuid)->where('is_del',1)->findOrEmpty();
- if ($bank->isEmpty()) $this->error('绑定记录不存在');
- $withdraw_min_price = sysconf('user.withdraw_min_price'); //最小提现金额
- $withdraw_max_price = sysconf('user.withdraw_max_price'); //最大提现金额
- $poundage_proportion = sysconf('user.poundage_proportion'); //手续费百分比
- $money < $withdraw_min_price ? $this->error('最低提现'.$withdraw_min_price.'元') : '';
- $money > $withdraw_max_price ? $this->error('最大提现'.$withdraw_min_price.'元') : '';
- $error = 1;
- Db::startTrans();
- try {
- $proportion = sprintf("%.2f", $money*($poundage_proportion/100)); //四舍五入保留两位小数点
- $real_money = bcsub($money,$proportion,2);
- $inset = [
- 'uuid'=>$this->uuid,
- 'order_no'=>setorderno($this->uuid),
- 'bink_id'=>$data['bind_id'],
- 'card_name'=>$bank['card_name'],
- 'name'=>$bank['name'],
- 'bank_id_card'=>$bank['id_card'],
- 'price'=>$money,
- 'poundage_proportion'=>$poundage_proportion,
- 'proportion'=>$proportion,
- 'real_money'=>$real_money
- ];
- $id = DataUserWithdraw::mk()->insertGetId($inset);
- //余额提现
- $res = userMoneyChange($money,1,$this->uuid,'余额提现',0,$id);
- if (!$res){
- $error = 0;
- $errorinfo = '提现失败';
- Db::rollback();
- }
- Db::commit();
- } catch (\Exception $e) {
- // 回滚事务
- Db::rollback();
- $error = 0;
- $errorinfo = '未知错误';
- }
- if ($error){
- $this->success('提现成功,等待审核');
- }
- $this->error($errorinfo);
- }
- /**
- * @Title("意见反馈列表")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("page&limit",type="string",require=0,default="",desc="分页")
- */
- public function feedbacklist(){
- $list = DataFeedback::Show($this->uuid)->with(['reply'])->paginate();
- $this->success('成功',$list);
- }
- /**
- * @Title("意见反馈提交")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("content",type="string",require=1,default="",desc="反馈内容")
- * @Param("imgs",type="string",require=0,default="",desc="图片,以逗号隔开")
- * @Param("phone",type="string",require=0,default="",desc="手机号")
- * @Param("id",type="string",require=0,default="",desc="修改,则必传之前提交的ID,只有未回复的能修改")
- */
- public function subfeedback(){
- $data = $this->_vali([
- 'uuid'=>$this->uuid,
- 'content.require'=>'反馈内容必须',
- 'imgs.default'=>'',
- 'phone.default'=>''
- ]);
- empty($id) ? : $data['update_at']=date('Y-m-d H:i:s');
- if (empty($id) ? DataFeedback::mk()->insert($data) : DataFeedback::mk()->where('id',$id)->update($data)){
- $this->success('提交成功');
- }
- $this->error('提交失败,请稍后重试');
- }
- /**
- * @Title("意见反馈删除")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("id",type="string",require=1,default="",desc="反馈ID")
- */
- public function delfeedback(){
- $data = $this->_vali([
- 'id.require'=>'ID必须',
- 'is_del.default'=>'0',
- ]);
- $id = $data['id'];
- unset($data['id']);
- DataFeedback::Show($this->uuid,$id)->count() ? '' : $this->error('信息不存在');
- if (DataFeedback::mk()->where('id',$id)->update($data)){
- $this->success('删除成功');
- }
- $this->error('删除失败,请稍后重试');
- }
- /**
- * @Title("我的收藏列表")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("type",type="string",require=1,default="",desc="1:知识教学2:百知文库3:采购订单4应聘信息,5:船厂")
- * @Param("longitude",type="string",require=1,default="",desc="经度,船厂必须")
- * @Param("latitude",type="string",require=1,default="",desc="纬度,船厂必须")
- * @Returned("shipyard",desc="船厂对象")
- * @Returned("shipyard.distance",desc="船厂距离你的距离km")
- * @Returned("title",desc="标题(知识教学,百知文库)")
- * @Returned("content",desc="内容(知识教学,百知文库)")
- * @Returned("imgs",desc="图片(知识教学,百知文库)")
- * @Returned("video",desc="视频(知识教学,百知文库)")
- * @Returned("file",desc="文件(知识教学,百知文库)")
- * @Returned("create_at",desc="创建时间(知识教学,百知文库)")
- * @Returned("update_at",desc="更新时间(知识教学,百知文库)")
- * @Returned("create_at",desc="创建时间(船厂)")
- * @Returned("address",desc="船厂地址(船厂)")
- * @Returned("business_img",desc="头像(船厂)")
- * @Returned("name",desc="船厂名称(船厂)")
- * @Returned("pos",desc="标签(船厂)")
- * @Returned("distance",desc="距离(船厂)")
- */
- public function mycollection(){
- $data = $this->_vali([
- 'type.require|in:1,2,3,4,5'=>'type有误'
- ]);
- switch ($data['type']){
- case 1:
- $list = DataCollectionLog::mk()
- ->hasWhere('teachingknowledge',function (Query $query){
- $query->where('is_del',1);
- })
- ->where('data_collection_log.uuid',$this->uuid)
- ->where('cate',1)
- ->where('data_collection_log.type',1)
- ->with(['teachingknowledge'=>function($query){
- $query->with(['user'=>function($query){
- $query->field('id,nickname,headimg,is_auth,is_vip');
- }]);
- }])
- ->order('id desc')
- ->paginate();
- break;
- case 2:
- $list = DataCollectionLog::mk()
- ->hasWhere('bestknowledge',function (Query $query){
- $query->where('is_del',1);
- })
- ->where('data_collection_log.uuid',$this->uuid)
- ->where('cate',1)
- ->where('data_collection_log.type',2)
- ->with(['bestknowledge'=>function($query){
- $query->with(['user'=>function($query){
- $query->field('id,nickname,headimg,is_auth,is_vip');
- }]);
- }])
- ->order('id desc')
- ->paginate();
- break;
- case 3:
- $list = ShopFavourite::mk()
- ->where('user_id',$this->uuid)
- ->order('id desc')
- ->paginate()
- ->toArray();
- foreach ($list['data'] as &$v){
- switch ($v['target_type']){
- case 'shop_purchase':
- $v['info'] = ShopPurchase::mk()
- ->where('id',$v['target_id'])
- ->with(['items','merchant'])
- ->findOrFail();
- break;
- case 'shop_production':
- $v['info'] = ShopProduction::mk()
- ->where('id',$v['target_id'])
- ->with(['items','merchant'])
- ->findOrFail();
- break;
- case 'shop_coordination':
- $v['info'] = ShopCoordination::mk()
- ->where('id',$v['target_id'])
- ->with(['items','merchant'])
- ->findOrFail();
- break;
- case 'shop_ocean':
- $v['info'] = ShopOcean::mk()
- ->where('id',$v['target_id'])
- ->with(['items','merchant'])
- ->findOrFail();
- break;
- }
- }
- break;
- case 4:
- $list = [];
- break;
- case 5:
- $data = $this->_vali([
- 'longitude.require'=>'经度必须',
- 'longitude.float'=>'经纬度必须是数字',
- 'latitude.require'=>'纬度必须',
- 'latitude.float'=>'经纬度必须是数字',
- ]);
- $list = DataCollectionLog::hasShipyard()
- ->where('uuid',$this->uuid)
- ->with(['shipyard'])
- ->paginate();
- foreach ($list as $item){
- $item['shipyard']->makeDistance($data['longitude'],$data['latitude']);
- }
- break;
- }
- $this->success('成功',$list);
- }
- /**
- * @Title("我的发布列表")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("type",type="string",require=1,default="",desc="1:知识教学2:百知文库3:应聘信息")
- * @Returned("audit",desc="1:待审核2:审核成功3:审核失败")
- * @Returned("why",desc="审核失败原因")
- */
- public function myrelease(){
- $data = $this->_vali([
- 'type.require|in:1,2,3'=>'type有误'
- ]);
- switch ($data['type']){
- case 1:
- $list = DataTeachingKnowledge::mk()
- ->where('uuid',$this->uuid)
- ->where('is_del',1)
- ->with(['user'=>function($query){
- $query->field('id,headimg,nickname');
- }])
- ->order('id desc')
- ->paginate();
- break;
- case 2:
- $list = DataBestKnowledge::mk()
- ->where('uuid',$this->uuid)
- ->where('is_del',1)
- ->with(['user'=>function($query){
- $query->field('id,headimg,nickname');
- },'classTo'])
- ->paginate();
- break;
- case 3:
- $list = DataUserApplyJobInfo::mk()
- ->where('uuid',$this->uuid)
- ->with(['workexperience','professionalskills','certificate'])
- ->findOrEmpty();
- if (!isset($list['id'])) $list = null;
- break;
- }
- $this->success('成功',$list);
- }
- /**
- * @Title("应聘信息隐藏,取消隐藏")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("hidden",type="string",require=1,default="",desc="0:隐藏 1:显示")
- */
- public function canhidden(){
- $data = $this->_vali([
- 'hidden.require|in:0,1'=>'字段有误',
- 'update_at.default'=>date('Y-m-d H:i:s')
- ]);
- DataUserApplyJobInfo::mk()->where('uuid',$this->uuid)->findOrEmpty() ? : $this->error('未提交') ;
- if (DataUserApplyJobInfo::mk()->where('uuid',$this->uuid)->update($data)){
- $this->success('成功');
- }
- $this->error('失败');
- }
- /**
- * @Title("我的需求")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("type",type="string",require=1,default="",desc="1:采购接单需求2:船机修理接单需求")
- */
- public function myneed(){
- $data = $this->_vali([
- 'type.require|in:1,2'=>'字段有误',
- ]);
- switch ($data['type']){
- case 1:
- $info = DataUserPurchaseAcceptance::mk()
- ->where('uuid',$this->uuid)
- ->findOrEmpty();
- if (!isset($info['id'])) $info = null;
- break;
- case 2:
- $info = DataUserAcceptance::mk()
- ->where('uuid',$this->uuid)
- ->findOrEmpty();
- if (!isset($info['id'])) $info = null;
- break;
- }
- $this->success('成功',$info);
- }
- /**
- * @Title("发布、修改采购接单需求")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("description",type="string",require=1,default="",desc="需求说明")
- * @Param("business_img",type="string",require=1,default="",desc="营业执照或身份证照")
- * @Param("imgs",type="string",require=1,default="",desc="图片及资质证件图片,多个以英文逗号隔开")
- * @Param("hidden",type="string",require=0,default="1",desc="是否隐藏1:不隐藏 2:隐藏")
- * @Param("province",type="string",require=1,default="",desc="定位-省")
- * @Param("city",type="string",require=1,default="",desc="定位-市")
- * @Param("area",type="string",require=1,default="",desc="定位-区")
- * @Param("id",type="string",require=0,default="",desc="修改时,传ID")
- */
- public function subpurchaseacceptance(){
- $data = $this->_vali([
- 'uuid.default'=>$this->uuid,
- 'description.require'=>'需求说明必须',
- 'business_img.require'=>'营业执照或身份证照必须',
- 'imgs.require'=>'图片及资质证件图片必须',
- // 'province.require'=>'定位-省',
- // 'city.require'=>'定位-市',
- // 'area.require'=>'定位-区',
- 'hidden.default'=>1
- ]);
- $id = input('id');
- empty($id) ? $id = DataUserPurchaseAcceptance::mk()->where('uuid',$this->uuid)->value('id') : '' ;
- empty($id) ? : $data['update_at']=date('Y-m-d H:i:s');
- empty($id) ? : $data['create_at']=date('Y-m-d H:i:s');
- //2023.10.13修改不需要审核
- !empty($id) ? (DataUserPurchaseAcceptance::mk()->where('uuid',$this->uuid)->where('id',$id)->value('status') == 2 ? $data['status'] = 2: '') : '';
- if (empty($id) ? DataUserPurchaseAcceptance::mk()->insert($data) : DataUserPurchaseAcceptance::mk()->where('id',$id)->update($data)){
- $this->success('提交成功');
- }
- $this->error('提交失败,请稍后重试');
- }
- /**
- * @Title("维修订单")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("type",type="string",require=1,default="",desc="1:我是船老板2:我是维修工")
- * @Param("status",type="string",require=1,default="",desc="1:未报价2:已报价3:已匹配")
- */
- public function repair(){
- $data = $this->_vali([
- 'type.require|in:1,2'=>'字段有误',
- 'status.require|in:1,2,3'=>'字段有误',
- ]);
- switch ($data['type']){
- case 1:
- $list = DataUserRepair::mk()
- ->where('uuid',$this->uuid)
- ->where('status',$data['status'])
- ->where('is_del',1)
- ->paginate();
- break;
- case 2:
- $status = $data['status'];
- $list = DataUserRepairOffer::mk()
- ->hasWhere('repair',function (Query $query){
- $query->where('is_del',1);
- })
- ->with(['repair'=>function($query){
- $query->withoutField('is_del,update_at');
- }])
- ->where('offer_id',$this->uuid)
- ->where(function ($query) use ($status){
- $repair_ids = DataUserRepairOffer::mk()
- ->where('offer_id',$this->uuid)
- ->where('price','>',0)
- ->group('repair_id')
- ->column('repair_id');
- switch ($status){
- case 1:
- $query->whereNotIn('repair_id',$repair_ids)->where('is_deal',0)->where('status',2);
- break;
- case 2:
- $query->whereIn('repair_id',$repair_ids)->where('is_deal',0)->where('status',2);
- break;
- case 3:
- $query->where('is_deal',1)->where('status',3);
- break;
- }
- })
- ->field('data_user_repair_offer.id,repair_id,offer_id')
- ->order('id desc')
- ->group('repair_id')
- ->paginate();
- $list = $list->toArray();
- foreach ($list['data'] as &$v){
- $in = DataUserRepairOffer::mk()
- ->where('repair_id',$v['repair_id'])
- ->where('offer_id',$v['offer_id'])
- ->order('id desc')
- ->limit(1)
- ->field('id,price')->find();
- $v['price'] = $in->price;
- }
- break;
- }
- $this->success('成功',$list);
- }
- /**
- * @Title("维修订单删除(只有维修订单未报价和已报价可以删除)")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("id",type="string",require=1,default="",desc="type为1时:维修单ID type为2时报价记录ID")
- */
- public function repairdel(){
- $data = $this->_vali([
- 'id.require'=>'id有误',
- ]);
- if (DataUserRepair::mk()->where('id',$data['id'])->where('uuid',$this->uuid)->update(['is_del'=>0])){
- $this->success('成功');
- }
- $this->error('失败');
- }
- /**
- * @Title("维修订单详情页")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("type",type="string",require=1,default="",desc="1:我是船老板2:我是维修工")
- * @Param("id",type="string",require=1,default="",desc="type为1时:维修单ID type为2时报价记录ID")
- */
- public function repairdetail(){
- $data = $this->_vali([
- 'type.require|in:1,2'=>'字段有误',
- 'id.require'=>'id有误',
- ]);
- // $this->uuid = 69;
- switch ($data['type']){
- case 1:
- $info = DataUserRepair::mk()
- ->where('uuid',$this->uuid)
- ->where('is_del',1)
- ->where('id',$data['id'])
- ->with(['user'=>function($query){
- $query->field('id,nickname,headimg,phone');
- },'offer'=>function($query){
- $query->field('id,repair_id,offer_id,price,imgs')->group('offer_id')
- ->with(['user'=>function($query){
- $query->field('id,nickname,headimg,phone');
- }]);
- },'success'=>function($query){
- $query->field('id,nickname,headimg,phone');
- }])
- ->find()->toArray();
- foreach ($info['offer'] as &$v){
- $in = DataUserRepairOffer::mk()
- ->where('repair_id',$data['id'])
- ->where('offer_id',$v['offer_id'])
- ->order('id desc')
- ->limit(1)
- ->field('id,price')->find();
- $v['id'] = $in->id;
- $v['price'] = $in->price;
- }
- break;
- case 2:
- $info = DataUserRepairOffer::mk()
- ->where('id',$data['id'])
- ->with(['user'=>function($query){
- $query->field('id,nickname,headimg,phone');
- },'repair'=>function($query){
- $query->with(['user'=>function($query){
- $query->field('id,nickname,headimg,phone');
- }]);
- }])
- ->find()->toArray();
- $in = DataUserRepairOffer::mk()
- ->where('repair_id',$info['repair_id'])
- ->where('offer_id',$info['offer_id'])
- ->order('id desc')
- ->limit(1)
- ->field('id,price')->find();
- $info['price'] = $in['price'];
- break;
- }
- $this->success('成功',$info);
- }
- /**
- * @Title("维修订单确认匹配")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("id",type="string",require=1,default="",desc="维修单ID")
- * @Param("offer_id",type="string",require=1,default="",desc="匹配的记录ID")
- */
- public function repairoffer(){
- $data = $this->_vali([
- 'id.require'=>'id有误',
- 'offer_id.require'=>'offer_id有误',
- ]);
- DataUserRepair::mk()->where('id',$data['id'])->value('status') == 3 ? $this->error('订单已经匹配成功') : '';
- $offer = DataUserRepairOffer::mk()->where('id',$data['offer_id'])->find();
- if (DataUserRepair::mk()->where('id',$data['id'])->update(['status'=>3,'success_uuid'=>$offer->offer_id,'success_price'=>$offer->price,'success_at'=>date('Y-m-d H:i:s')])
- &&
- DataUserRepairOffer::mk()->where('id',$data['offer_id'])->update(['is_deal'=>1,'deal_at'=>date('Y-m-d H:i:s')])){
- $url = setword(1,$data['id']);
- DataUserRepair::mk()->where('id',$data['id'])->update(['down_word'=>$url]);
- //极光推送
- $content = '维修订单已匹配成功,请及时查看';
- $alias = DataUser::mk()->where('id',$offer['offer_id'])->value('jgalias');
- //$alias ? jgpush($content,$alias) : '';
- setusermessage($offer['offer_id'],'匹配通知',$content);
- $this->success('成功');
- }
- $this->error('失败');
- }
- /**
- * @Title("维修订单详情页用户报价列表点击查看详情")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("id",type="string",require=1,default="",desc="维修单ID")
- * @Param("offer_id",type="string",require=1,default="",desc="匹配的offer_id")
- */
- public function userofferinfo(){
- $data = $this->_vali([
- 'id.require'=>'id有误',
- 'offer_id.require'=>'offer_id有误',
- ]);
- // $this->uuid = 69;
- $offer_id = $data['offer_id'];
- $list = DataUserRepairOffer::mk()
- ->where('repair_id',$data['id'])
- ->where(function ($query) use ($offer_id){
- $query->where('offer_id',$offer_id);
- })
- ->field('id,price')
- ->select();
- $imgs = array_filter(explode(',',DataUserRepairOffer::mk()->where('repair_id',$data['id'])
- ->where('offer_id',$offer_id)
- ->order('id desc')
- ->limit(1)
- ->value('imgs')));
- $messagelist = DataUserLeaveMessage::mk()
- ->where('type',1)
- ->whereRaw("(uuid=$this->uuid and uuid2=$offer_id) or (uuid2=$this->uuid and uuid=$offer_id)")
- ->where('link_id',$data['id'])
- ->with(['user'=>function($query){
- $query->field('id,nickname,headimg');
- }])
- ->field('id,uuid,uuid2,content,create_at')
- ->select();
- $this->success('成功',compact('list','imgs','messagelist'));
- }
- /**
- * @Title("维修订单留言")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("id",type="string",require=1,default="",desc="维修单ID")
- * @Param("offer_id",type="string",require=1,default="",desc="匹配的记录ID")
- * @Param("content",type="string",require=1,default="",desc="内容")
- */
- public function subleavemessage(){
- $data = $this->_vali([
- 'id.require'=>'id有误',
- 'offer_id.require'=>'offer_id有误',
- 'content.require'=>'内容必须',
- ]);
- $offer = DataUserRepairOffer::mk()->where('id',$data['offer_id'])->findOrEmpty();
- $array = [
- 'uuid'=>$this->uuid,
- 'uuid2'=>$offer->offer_id,
- 'content'=>$data['content'],
- 'type'=>1,
- 'link_id'=>$data['id'],
- ];
- if (DataUserLeaveMessage::mk()->insert($array)){
- $this->success('成功');
- }
- $this->error('失败');
- }
- /**
- * @Title("维修订单维修工回复留言")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("id",type="string",require=1,default="",desc="维修单ID")
- * @Param("content",type="string",require=1,default="",desc="内容")
- */
- public function subofferleavemessage(){
- $data = $this->_vali([
- 'id.require'=>'id有误',
- 'content.require'=>'内容必须',
- ]);
- $repair = DataUserRepair::mk()->where('id',$data['id'])->findOrEmpty();
- $array = [
- 'uuid'=>$this->uuid,
- 'uuid2'=>$repair->uuid,
- 'content'=>$data['content'],
- 'type'=>1,
- 'link_id'=>$data['id'],
- ];
- if (DataUserLeaveMessage::mk()->insert($array)){
- $this->success('成功');
- }
- $this->error('失败');
- }
- /**
- * @Title("维修订单维修工查看留言列表")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("id",type="string",require=1,default="",desc="维修单ID")
- */
- public function suboffermessagelist(){
- $data = $this->_vali([
- 'id.require'=>'id有误',
- ]);
- // $this->uuid = 54;
- $uid = DataUserRepair::mk()->where('id',$data['id'])->value('uuid');
- if (!$uid) $this->error('订单未找到');
- $messagelist = DataUserLeaveMessage::mk()
- ->where('type',1)
- ->where('link_id',$data['id'])
- ->whereRaw("(uuid=$this->uuid and uuid2=$uid) or uuid2=$this->uuid and uuid=$uid")
- // ->whereRaw("uuid=$this->uuid or uuid2=$this->uuid")
- ->with(['user'=>function($query){
- $query->field('id,nickname,headimg');
- }])
- ->field('id,uuid,uuid2,content,create_at')
- ->select();
- $this->success('成功',$messagelist);
- }
- /**
- * @Title("消息未读数量")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Returned("message_count",desc="后台消息未读数量")
- * @Returned("notice_count",desc="系统通知未读数量")
- */
- public function messagenoread(){
- $message = BaseUserMessage::mk()
- ->where('type','message')
- ->where('status',1)
- ->where('deleted',0)
- ->column('id');
- $notice = BaseUserMessage::mk()
- ->where('type','notice')
- ->where('status',1)
- ->where('deleted',0)
- ->where('uuid',$this->uuid)
- ->column('id');
- $message_read_count = BaseUserMessageRead::mk()->where('uuid',$this->uuid)->whereIn('message_id',$message)->count();
- $notice_read_count = BaseUserMessageRead::mk()->where('uuid',$this->uuid)->whereIn('message_id',$notice)->count();
- $array = [
- 'message_count'=>count($message)-$message_read_count,
- 'notice_count'=>count($notice)-$notice_read_count
- ];
- $this->success('成功',$array);
- }
- /**
- * @Title("消息")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("type",type="string",require=1,default="",desc="message:后台消息 notice:系统通知")
- * @Returned("is_read",desc="1:已读 0:未读")
- */
- public function messagelist(){
- $data = $this->_vali([
- 'type.require'=>'type有误',
- ]);
- $type = $data['type'];
- $messagelist = BaseUserMessage::mk()
- ->where('type',$data['type'])
- ->when($type,function ($query) use ($type){
- if ($type=='notice'){
- $query->where('uuid',$this->uuid);
- }
- })
- ->where('status',1)
- ->where('deleted',0)
- ->withoutField('deleted,sort,num_read,status')
- ->order('id desc')
- ->paginate()->toArray();
- foreach ($messagelist['data'] as &$v){
- $v['is_read'] = BaseUserMessageRead::mk()->where('uuid',$this->uuid)->where('message_id',$v['id'])->count() ? 1 : 0;
- }
- $this->success('成功',$messagelist);
- }
- /**
- * @Title("点击消息")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("id",type="string",require=1,default="",desc="消息ID")
- */
- public function readmessage(){
- $data = $this->_vali([
- 'id.require'=>'id有误',
- ]);
- $info = BaseUserMessage::mk()->where('id',$data['id'])->findOrEmpty();
- BaseUserMessageRead::mk()->where('uuid',$this->uuid)->where('message_id',$data['id'])->count() ? :
- BaseUserMessageRead::mk()->insert(['message_id'=>$data['id'],'uuid'=>$this->uuid]);
- $this->success('成功',$info);
- }
- /**
- * @Title("获取安卓版本")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- *
- * @Returned("version",desc="当前版本")
- * @Returned("name",desc="版本名")
- * @Returned("title",desc="更新标题")
- * @Returned("isCompel",desc="1:强制更新 0:不强制更新")
- * @Returned("content",desc="更新内容")
- * @Returned("download_url",desc="下载地址")'
- *
- * @Returned("version2",desc="商家端当前版本")
- * @Returned("name2",desc="商家端版本名")
- * @Returned("title2",desc="商家端更新标题")
- * @Returned("isCompel2",desc="商家端1:强制更新 0:不强制更新")
- * @Returned("content2",desc="商家端更新内容")
- * @Returned("download_url2",desc="商家端下载地址")
- */
- public function getandroidversion(){
- $info= [
- 'version'=>(int)sysconf('android.version'),
- 'name'=>sysconf('android.name'),
- 'title'=>sysconf('android.title'),
- 'isCompel'=>(int)sysconf('android.isCompel'),
- 'content'=>sysconf('android.content'),
- 'download_url'=>sysconf('android.download_url'),
- 'version2'=>(int)sysconf('android.version2'),
- 'name2'=>sysconf('android.name2'),
- 'title2'=>sysconf('android.title2'),
- 'isCompel2'=>(int)sysconf('android.isCompel2'),
- 'content2'=>sysconf('android.content2'),
- 'download_url2'=>sysconf('android.download_url2'),
- ];
- $this->success('成功',$info);
- }
- /**
- * @Title("获取ios版本")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- *
- * @Returned("version",desc="当前版本")
- * @Returned("name",desc="版本名")
- * @Returned("title",desc="更新标题")
- * @Returned("isCompel",desc="1:强制更新 0:不强制更新")
- * @Returned("content",desc="更新内容")
- */
- public function getiosversion(){
- $info= [
- 'version'=>(int)sysconf('ios.version'),
- 'name'=>sysconf('ios.name'),
- 'title'=>sysconf('ios.title'),
- 'isCompel'=>(int)sysconf('ios.isCompel'),
- 'content'=>sysconf('ios.content'),
- // 'download_url'=>sysconf('android.download_url'),
- ];
- $this->success('成功',$info);
- }
- /**
- * @Title("获取商家入驻规则、船厂入驻规则")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- *
- * @Returned("business_join_rule",desc="商家入驻规则")
- * @Returned("shipyard_join_rule",desc="船厂入驻规则")
- * @Returned("auth_rule",desc="实名认证授权")
- * @Returned("privacy_policy",desc="隐私政策")
- */
- public function getrule(){
- $info= [
- 'business_join_rule'=>htmlspecialchars_decode(sysconf('business.business_join_rule')),
- 'shipyard_join_rule'=>htmlspecialchars_decode(sysconf('shipyard.shipyard_join_rule')),
- 'auth_rule'=>htmlspecialchars_decode(sysconf('user.auth_rule')),
- 'privacy_policy'=>htmlspecialchars_decode(sysconf('user.privacy_policy')),
- 'download_url_code'=>sysconf('android.download_url_code'),
- ];
- $this->success('成功',$info);
- }
- /**
- * @Title("账号注销")
- * @Method("post")
- * @Header("api-name",type="string",require=1,default="",desc="访问类型")
- * @Header("api-token",type="string",require=1,default="",desc="token")
- * @Param("code",type="string",require=1,default="",desc="验证码")
- * @Param("phone",type="string",require=1,default="",desc="手机号")
- *
- */
- public function cancellation(){
- $data = $this->_vali([
- 'code.require'=>'验证码不能为空',
- 'phone.require'=>'手机号不能为空'
- ]);
- if (!MessageService::instance()->checkCode($data['code'], $data['phone'],7)) {
- $this->error('手机短信验证失败!');
- }
- //剩余订单
- $order = ShopOrder::mk()->where(['uuid'=>$this->user['id']])->whereIn('status','4,5,7')->find();
- if($this->user['money'] !=0.00 && $order){
- $this->success('',['type'=>2,'failReason'=>['当前账号钱包余额不为0,请消费或者提现至银行卡之后再申请!','账号有交易未完成,为保障交易信息的安全和完整性,请交易结束后再申请']]);
- }
- if($this->user['money'] !=0.00){
- $this->success('',['type'=>2,'failReason'=>['当前账号钱包余额不为0,请消费或者提现至银行卡之后再申请!']]);
- }
- if($order){
- $this->success('',['type'=>2,'failReason'=>['账号有交易未完成,为保障交易信息的安全和完整性,请交易结束后再申请']]);
- }
- $arr = ['status'=>0,'deleted'=>1];
- if (DataUser::mk()->where('id',$this->uuid)->update($arr)){
- // $merchant = Merchant::mk()->where('uuid',$this->uuid)->find();
- //shop_production 生产订单
- //shop_purchase 采购订单
- //shop_coordination 外协订单
- //shop_ocean 海运订单
- // DataUser::mk()->where('id',$this->uuid)->delete();
- $this->success('注销成功',['type'=>1,'failReason'=>null]);
- }
- }
- public function ccc(){
- // $list = DataUserRepair::mk()->where('status',3)->select();
- // foreach ($list as &$v){
- // $url = setword(1,$v['id']);
- // DataUserRepair::mk()->where('id',$v['id'])->update(['down_word'=>$url]);
- // }
- // die();
- echo setword(5,5);
- die;
- // $dir = dirname(realpath(dirname($_SERVER['SCRIPT_FILENAME']))) . '/public/';
- // $templateProcessor = new TemplateProcessor($dir.'/wxdd.docx');
- // $templateProcessor->setValue('order_no','1234');
- // $templateProcessor->setValue('date','2023-02-20 15:05:50');
- // $templateProcessor->setValue('fbz','张三');
- // $templateProcessor->setValue('jdf','李四');
- // $templateProcessor->setValue('fbzphone','15800000000');
- // $templateProcessor->setValue('jdfphone','15800000001');
- // $templateProcessor->setValue('address','藕粉色大后方胡搜凤凰山佛山房');
- // $templateProcessor->setValue('time','2023-02-20 15:10:00');
- // $templateProcessor->setValue('desc','维修单维修单');
- // $templateProcessor->setValue('price','100');
- // $templateProcessor->saveAs($dir."b.docx");
- $dir = dirname(realpath(dirname($_SERVER['SCRIPT_FILENAME']))) . '/public/';
- $templateProcessor = new TemplateProcessor($dir.'/cgdd.docx');
- $templateProcessor->setValue('order_no','2312312313');
- $templateProcessor->cloneRow('id',3);
- $templateProcessor->setValue('id#1', '1');
- $templateProcessor->setValue('bh#1', '1');
- $templateProcessor->setValue('name#1', '名称');
- $templateProcessor->setValue('gg#1', '规格');
- $templateProcessor->setValue('num#1', '10');
- $templateProcessor->setValue('price#1', '10');
- $templateProcessor->setValue('allprice#1', '20');
- $templateProcessor->setValue('id#2', '1');
- $templateProcessor->setValue('bh#2', '1');
- $templateProcessor->setValue('name#2', '名称');
- $templateProcessor->setValue('gg#2', '规格');
- $templateProcessor->setValue('num#2', '10');
- $templateProcessor->setValue('price#2', '10');
- $templateProcessor->setValue('allprice#2', '20');
- $templateProcessor->setValue('id#3', '1');
- $templateProcessor->setValue('bh#3', '1');
- $templateProcessor->setValue('name#3', '名称');
- $templateProcessor->setValue('gg#3', '规格');
- $templateProcessor->setValue('num#3', '10');
- $templateProcessor->setValue('price#3', '10');
- $templateProcessor->setValue('allprice#3', '20');
- $templateProcessor->saveAs($dir."c.docx");
- }
- public function send(){
- $alias = 'user_70';
- $content = '代码测试推送';
- $client = new jpush('9dd98f61eb4ad58dca4c8214','f7cac744173f8ace703719cf');
- $response = $client->push()
- ->setPlatform(array('ios', 'android'))
- ->addAlias($alias)
- // ->addRegistrationId($registration_id)
- ->setNotificationAlert($content)
- ->options([
- 'sendno' => 100,
- 'time_to_live' => 86400,
- 'apns_production' => false,
- 'big_push_duration' => 0
- ])
- ->send();
- dump($response);die;
- }
- }
|