fastadmin 接口(上传)

/**
* 添加注释指南
*
*/

public function store(Request $request)
{
dump($request);exit;
$name = $request->param('name');
$content = $request->param('content');
$cover = $request->param('cover');
$video = $request->param('video');

$comment = new ApparatusModel();
$comment->name = $name;
$comment->content = $content;
$comment->cover = $cover;
$comment->video = $video;
$comment->add_time = date('Y-m-d H:i:s', time());
$comment->save();

$this->success();


}

 

=====================

public function share(Request $request)
{
//获取openid
$openid = $request->user->openid;

//查询之前邀请中人数
$invited_num = Trainer::where('openid',$openid)->value('invited_num')+1;
$result = Trainer::where('openid',$openid)->update(['invited_num'=>$invited_num]);
//返回数据
$this->success($result);
}

 

----------

/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/6/23
* Time: 15:34
*/

namespace app\admin\model;

use think\Model;

class Useraddress extends Model
{
// 表名
protected $name = 'User_address';

protected $hidden=['id','delete_time','userid'];

 

}

转载于:https://www.cnblogs.com/vip-deng-vip/p/9448757.html

你可能感兴趣的:(fastadmin 接口(上传))