|
|
|
@ -7,7 +7,9 @@ use app\dao\admin\SelfMediasDao; |
|
|
|
use app\dao\user\CreationArticleDao; |
|
|
|
use app\dao\user\CreationArticleReceiveRecordsDao; |
|
|
|
use plugin\piadmin\app\base\BaseService; |
|
|
|
use plugin\piadmin\app\dao\UserDao; |
|
|
|
use plugin\piadmin\app\exception\ApiException; |
|
|
|
use plugin\piadmin\app\utils\RequestUtils; |
|
|
|
|
|
|
|
class ApiService extends BaseService |
|
|
|
{ |
|
|
|
@ -19,6 +21,7 @@ class ApiService extends BaseService |
|
|
|
protected $selfMediasDao; |
|
|
|
protected $creationArticleDao; |
|
|
|
protected $creationArticleReceiveRecordsDao; |
|
|
|
protected $userDao; |
|
|
|
|
|
|
|
public function __construct() |
|
|
|
{ |
|
|
|
@ -26,6 +29,7 @@ class ApiService extends BaseService |
|
|
|
$this->selfMediasDao = app()->make(SelfMediasDao::class); |
|
|
|
$this->creationArticleDao = app()->make(CreationArticleDao::class); |
|
|
|
$this->creationArticleReceiveRecordsDao = app()->make(CreationArticleReceiveRecordsDao::class); |
|
|
|
$this->userDao = app()->make(UserDao::class); |
|
|
|
} |
|
|
|
|
|
|
|
public function receive($params) |
|
|
|
@ -38,6 +42,12 @@ class ApiService extends BaseService |
|
|
|
} else { |
|
|
|
throw new ApiException('投稿失败'); |
|
|
|
} |
|
|
|
//查用户余额
|
|
|
|
$userInfo = RequestUtils::getUserInfo(); |
|
|
|
$currentUser = $this->userDao->get($userInfo['id']); |
|
|
|
if ($currentUser['balance'] < $media['price_assign']) { |
|
|
|
throw new ApiException('投稿点数余额不足'); |
|
|
|
} |
|
|
|
|
|
|
|
$time_out = 60; |
|
|
|
$url = $this->url; |
|
|
|
|