Skip to content

Commit

Permalink
主播录入
Browse files Browse the repository at this point in the history
  • Loading branch information
wuceyang committed Feb 8, 2017
1 parent e32227e commit 053b88d
Show file tree
Hide file tree
Showing 8 changed files with 412 additions and 14 deletions.
68 changes: 67 additions & 1 deletion app/C/Admin/Actor.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,36 @@

use \Request;
use \Response;
use \App\Helper\Enum;
use \App\M\Actor AS mActor;
use \App\M\Talent;
use \App\M\LivePlatform;

class Actor extends Base{

public function addnew(Request $req, Response $resp){

if(!$req->isPost()){

return $resp->withView('admin/actor_add.html')->display();
$talent = new Talent();

$talents = $talent->getList();

$platform = new LivePlatform();

$platforms = $platform->getList();

$param = [

'talent' => $talents,

'platform' => $platforms,

'gender' => Enum::Gender,

];

return $resp->withVars($param)->withView('admin/actor_add.html')->display();
}

$actorName = trim($req->post('name'));
Expand Down Expand Up @@ -47,6 +68,51 @@ public function addnew(Request $req, Response $resp){
$photos = $req->post('photos');

$video = $req->post('video');

if(!$actorName){

return $this->resp->error("主播姓名不能为空", 101);
}

if(!strtotime($startTime)){

return $this->resp->error("入职时间不能为空", 101);
}

if(!$nickName){

return $this->resp->error("主播昵称不能为空", 101);
}

$actorInfo = [
'TrueName' => $actorName,
'HireDate' => $startTime,
'Gender' => $gender,
'ContractYears' => $signYear,
'NickName' => $nickName,
'WorkCity' => $stayCity,
'Birthday' => $birthDate,
'Height' => $tall,
'Mobile' => $mobile,
'Wechat' => $wechat,
'LivePlatform' => implode(',', $platform),
'HotDegree' => $hotdegree,
'TotalFans' => $followers,
'Talent' => implode(',', $talent),
'Experientce' => $experience,
'ImageAttach' => json_encode($photos),
'ImageVideo' => $video,
'CreatorID' => $this->userinfo['ID'],
];

$actor = new mActor();

if(!$actor->insert($actorInfo)){

return $this->resp->error("主播信息保存失败", 201);
}

return $this->resp->success('','');
}

public function search(Request $req, Response $resp){
Expand Down
4 changes: 4 additions & 0 deletions app/Helper/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ class Enum{
'精彩视频' => 2,
'原创音乐' => 3,
];
const Gender = [
1 => '',
2 => '',
];
}
14 changes: 2 additions & 12 deletions app/M/Actor.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,7 @@

class Actor extends Model{

public static $table = 'tbl_actor';
public static $table = 'Qualified_Actress';

public function getActorByName($actorName){

return $this->where('nickname = ?', [$actorName])->getRow();
}

public function actorSearch($actorName){

$likeStr = "%" . addcslashes($actorName, '_%') . "%";

return $this->where('nickname like ?', [$likeStr])->page(0)->pagesize(10)->getRows();
}

}
8 changes: 8 additions & 0 deletions app/M/LivePlatform.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
namespace App\M;

class LivePlatform extends Model{

public static $table = 'LivePlatform';

}
8 changes: 8 additions & 0 deletions app/M/Talent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
namespace App\M;

class Talent extends Model{

public static $table = 'Talent';

}
Loading

0 comments on commit 053b88d

Please sign in to comment.