This commit is contained in:
wangjinlei
2021-02-19 11:25:27 +08:00
parent 4712826e8b
commit c6e41c6035
3 changed files with 70 additions and 16 deletions

View File

@@ -134,17 +134,26 @@ class Journal extends Controller {
*/
public function getJournalTopic() {
$data = $this->request->post();
$p_res = $this->journal_topic_obj
->where('journal_id', $data['journal_id'])
->where('state', 0)
->where('parent_id',0)
->order('sort')
->select();
$res = $this->journal_topic_obj
->where('journal_id', $data['journal_id'])
->where('state', 0)
->where('parent_id','>',0)
->order('sort asc,journal_topic_id asc')
->select();
//处理数组
$frag = [];
foreach ($res as $v) {
if ($v['parent_id'] == 0) {
$frag[] = $v;
}
}
$frag = $p_res;
// foreach ($res as $v) {
// if ($v['parent_id'] == 0) {
// $frag[] = $v;
// }
// }
foreach ($frag as $kk => $vv) {
$frag[$kk] = $this->getChieldarr($vv, $res);
}
@@ -650,6 +659,7 @@ class Journal extends Controller {
$repeat = $this->subscribe_journal_obj
->where('journal_id', $data['journal_id'])
->where('email', $data['email'])
->where('state',0)
->find();
if ($repeat) {
return jsonError('repeat subscribe!');
@@ -691,6 +701,7 @@ class Journal extends Controller {
$repeat = $this->subscribe_topic_obj
->where('topic_id', $data['topic_id'])
->where('email', $data['email'])
->where('state',0)
->find();
if ($repeat) {
return jsonError('repeat subscribe!');